如何在会话中存储gridview单元格值
问题描述:
大家好,
我有一个已填充的gridview.我还有一个用户单击的动态超链接列.当他们单击此链接时,我希望将该单元格的值存储在会话中.我需要此会话变量才能在新页面上加载数据.
Hi all,
I have a gridview that is populated. I also have a dynamic hyperlink column that the user clicks on. When they click on this link, I want the value of that cell to be stored in a session. I need this session variable to load data on the new page.
Any answer will be higly appreciated
答
您可以使用层后面的代码来实现它:
You can achieve it using code behind layer as:
MyDataItem item = (MyDataItem)GridView1.Rows[GridView1.SelectedIndex].DataItem;
Session["myItem"] = item;