简体   繁体   English

当我的控件和数据来自母版页时,如何将数据传递到服务器并将页面重定向到下一个内容页?

[英]How can pass data to server and page redirected to next content page as my control and data is from master page?

I have taken five dropdown lists in master page and one Imagebutton. 我已经在母版页和一个Imagebutton中设置了五个下拉列表。 On click of Image button values of dropdown list are passed to server side for processing and result will be displayed on another content page. 单击图像按钮后,下拉列表的值将传递到服务器端进行处理,结果将显示在另一个内容页面上。

Use can use Session Variables like shown below: 使用可以使用如下所示的Session变量:

First initiate Session variable with values 首先使用值初始化Session变量

Session["variablename"] = value //can be int, string, datatable, array etc

Use on other page 在其他页面上使用

getvalue = Session["variablename"].ToString() //if the value is string type (or convert it accordingly)

If use of Session Variable are over then dump it. 如果Session变量的使用已结束,则将其转储。

Session.Remove("variablename");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM