下拉列表会话 [英] session of dropdownlist

查看:61
本文介绍了下拉列表会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好......

我有两个页面,两个都有相同的下拉列表,现在我想在会话中传递所选项目的值并将该值传递到另一个页面..我也做该dropdownlist选择为true从第一页传递的值。

例如如果我从下拉列表中选择gujarat然后在州下拉列表的另一页上选择gujarat。



提前谢谢

解决方案

第一页使用此代码

  protected   void  DropDownList1_SelectedIndexChanged( object  sender,EventArgs e)
{
Session [ t2] = DropDownList1.Text;
}



第二页

 受保护 < span class =code-keyword> void  Page_Load( object  sender,EventArgs e)
{
DropDownList1.Text = Session [ t2]。toString();
}


您好rahul,



还有一个问题。



如果您从数据库获取下拉值,则从第一页的下拉列表中选择一个值并在会话中存储所选的ID,在第二页下拉列表中显示会话ID值。 / BLOCKQUOTE>

Hi all...
I have two page and both have same dropdownlist, now i want to pass value of selected item in session and pass that value in another page..and i also make that dropdownlist selected true which value is passed from first page..
for e.g. if i select gujarat from dropdown list then on another page of state dropdownlist select gujarat.

Thanks in advance

解决方案

First page use this code

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
     {
       Session["t2"] = DropDownList1.Text;
     }


Second page

protected void Page_Load(object sender, EventArgs e)
        {
         DropDownList1.Text=Session["t2"].toString();
        }


Hi rahul,

One more way for your question.

If you are getting drop down values from database then select one value from dropdownlist of first page and store selected id in session, show session id value in second page dropdown.


这篇关于下拉列表会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆