DropdownList SelectedItem无法正常工作

时间:2013-05-09 17:05:28

标签: c# asp.net drop-down-menu

在尝试获取DropDownList的选定值时,我遇到了一个非常奇怪的问题。我的页面上有以下控件:4个DropDownList,2个文本框,6个ListBox和一个按钮。 现在点击按钮,所有控件都保留了它的数据,我可以从后面的代码中访问它们。 buut有一个控件不会以相同的方式运行。它是4 DropDownlist中的一个。尝试执行以下操作时,只需获取一个空字符串:

string sData1 = this.DropDownList1.SelectedValue;  --> works OK
string sData2 = this.DropDownList2.SelectedValue;  --> works OK
string sData3 = this.DropDownList3.SelectedValue;  --> works OK
string sData4 = this.DropDownList4.SelectedValue;  --> is NOT working

基本上这是我为每个DropDownList提供的HTML标记:

<asp:DropDownList ID="DropDownLis1" runat="server"></asp:DropDownList>
<asp:DropDownList ID="DropDownLis2" runat="server"></asp:DropDownList>
<asp:DropDownList ID="DropDownLis3" runat="server"></asp:DropDownList>
<asp:DropDownList ID="DropDownLis4" runat="server"></asp:DropDownList>

我在互联网上搜索是否有相关内容但没有运气。 我有另一个疑问如下。是否有可能视图状态已满并且它不存储该DropDownList的选定值?

任何线索或帮助都会非常感激 感谢

0 个答案:

没有答案
相关问题