获取 LoadViewState 中选定单选按钮的值
我可以在 WebControl 的 LoadViewState 事件中获取所选单选按钮的值吗?如何获取?所有组件都是在代码隐藏中生成的,所以我有这些控件:
RadioButtonList rbl;
ListItem liOne;
ListItem liTwo;
目前我坚持认为重写的 LoadViewState 没有被调用
protected override void LoadViewState(object o)
{
action = rbl.SelectedValue;
action2 = rbl.SelectedItem.Value;
base.LoadViewState(o);
}
can i get a value of a selected radio button in LoadViewState event of the the WebControl and how? All the components are generated in codebehind, so i have those controls:
RadioButtonList rbl;
ListItem liOne;
ListItem liTwo;
at the moment i am stuck at that the overriden LoadViewState is not being invoked
protected override void LoadViewState(object o)
{
action = rbl.SelectedValue;
action2 = rbl.SelectedItem.Value;
base.LoadViewState(o);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您还需要重写 SaveViewState 方法。据我所知,单选按钮在保存其选定状态时存在问题。
https://web. archive.org/web/20211020153240/https://www.4guysfromrolla.com/articles/110205-1.aspx链接文本
You also need to override the SaveViewState method. Radio buttons AFAIK have problems saving their selected state.
https://web.archive.org/web/20211020153240/https://www.4guysfromrolla.com/articles/110205-1.aspxlink text