当前位置: 代码迷 >> ASP.NET >> 十分急DropDownList的有关问题
  详细解决方案

十分急DropDownList的有关问题

热度:5862   发布时间:2013-02-26 00:00:00.0
十分急!!DropDownList的问题
下面这些代码:
  <asp:DropDownList   id= "ModeList "   AutoPostBack= "True "
            OnSelectedIndexChanged= "Selection_Change "
            runat= "server ">
  <asp:ListItem   Value= "su ">   Month   </asp:ListItem>
  <asp:ListItem   Value= "ke "   Selected= "True ">   MonthYear   </asp:ListItem>
  </asp:DropDownList>
DropDownList默认显示行为:MonthYear。我选择了Moth,这行,DropDownList就显示了Moth这行,我刷新了页面,DropDownList又跳回了MonthYear,我想要页面刷新后,不跳回显示MonthYear而是显示Moth这行,用代码怎么实现,谢谢各位大虾吗?

------解决方案--------------------------------------------------------
可以将选择项保存在ViewState里,页面加载时根据这个设置哪个selected
  相关解决方案