ASP.NET下拉菜单选择的值?
我有一个 ASP.NET 下拉列表,并使用 .SelectedValue 获取选定的值。在某些情况下,我还通过分配来设置该值。即使我从下拉列表中选择该项目,我似乎也随机没有设置该值。有时有效,有时无效。
有想法吗?
I've an ASP.NET dropdown list and getting selected value by using the .SelectedValue. I also set this value in some cases by assigning to it. I seem to be randomly not getting this value set even when I choose the item from the drop down. Sometimes it works and sometimes it doesn't.
Ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您在 Page_Load 绑定数据,请确保您没有通过检查页面是否回发来重新绑定。
I you are binding your data at Page_Load make sure you're not re-binding by checking if page is post back.
确保在检查选择之前没有在回发时重新绑定数据。
另外,您是否创建列表项并将列表项插入到多个列表中?如果您选择一个列表,它将更改另一个列表。
Make sure you are not re-binding the data on postback before you are able to check the selection.
Also, are you creating listitems and inserting the listitem into multiple lists? If you select one list, it will change the other.