セッションに入れた辞書があり、ボタンをクリックするたびに何らかの操作を実行する必要があります。
itemColl = new Dictionary<int, int>();
セッション変数で保持しているキーを検索したいのですが、キーが存在する場合は、対応するキーの値を 1 増やしたいのですが、どうすればこれを達成できますか。
私は次のように試しています:
if (Session["CurrCatId"] != null)
{
CurrCatId = (int)(Session["CurrCatId"]);
// this is the first time, next time i will fetch from session
// and want to search the currcatid and increase the value from
// corresponding key by 1.
itemColl = new Dictionary<int, int>();
itemColl.Add(CurrCatId, 1);
Session["itemColl"] = itemColl;
}