C# 在GridView中使用会话,在C中使用ASP.net#
我想获取所选行的C# 在GridView中使用会话,在C中使用ASP.net#,c#,asp.net,session,gridview,C#,Asp.net,Session,Gridview,我想获取所选行的候选\u id(主键)。并使用会话将值传递给其他Web表单。 ASP代码 如何访问另一页中的会话[“id”]? 我试图访问会话[“id”],但仍然为空。请帮忙 另一页的C代码 protected void Page_Load(object sender, EventArgs e) { TextBox3.Text = (String)Session["id"]; } 我认为您应该验证web.Config是如何配置的
候选\u id
(主键)。并使用会话将值传递给其他Web表单。ASP代码
如何访问另一页中的会话[“id”]? 我试图访问
会话[“id”]
,但仍然为空。请帮忙
另一页的C代码
protected void Page_Load(object sender, EventArgs e)
{
TextBox3.Text = (String)Session["id"];
}
我认为您应该验证web.Config是如何配置的,以及页面是如何配置的。检查以下文档:
请验证应用程序web.config中的会话模式并指定选项
<sessionState mode="Off|InProc|StateServer|SQLServer"
cookieless="true|false"
timeout="number of minutes"
stateConnectionString="tcpip=server:port"
sqlConnectionString="sql connection string"
stateNetworkTimeout="number of seconds"/>
protected void Page_Load(object sender, EventArgs e)
{
TextBox3.Text = (String)Session["id"];
}
<sessionState mode="Off|InProc|StateServer|SQLServer"
cookieless="true|false"
timeout="number of minutes"
stateConnectionString="tcpip=server:port"
sqlConnectionString="sql connection string"
stateNetworkTimeout="number of seconds"/>
protected void Page_Load(object sender, EventArgs e)
{
if(!isPostBack){
TextBox3.Text = (String)Session["id"].ToString(); }
}