【问题标题】:Retriving radiobutton list from session从会话中检索单选按钮列表
【发布时间】:2014-03-09 22:19:16
【问题描述】:

从会话中检索单选按钮列表选择。我有一个单选按钮列表。当我返回页面时,我想拥有我选择的内容。单选按钮列表由字符串数组填充

向会话添加选择

                  Session["selection"] = RadioButtonList1.SelectedIndex;

页面加载

                    if (!IsPostBack)
                    {
                    RadioButtonList1.SelectedIndex = (string)Session["selection"];
                    }

不知道为什么不工作

【问题讨论】:

    标签: c# asp.net


    【解决方案1】:

    来自 MSDN:ListControl.SelectedIndex Property

    获取或设置所选项目的最低序号索引 列表。

    试试这个:

    RadioButtonList1.SelectedIndex = Convert.ToInt32(Session["selection"]);
    

    【讨论】:

      猜你喜欢
      • 2017-11-19
      • 2013-03-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-03
      • 1970-01-01
      • 1970-01-01
      • 2020-03-03
      • 2016-02-08
      相关资源
      最近更新 更多