【问题标题】:Refresh RadioButtonList in asp.net在 asp.net 中刷新 RadioButtonList
【发布时间】:2013-10-14 18:50:46
【问题描述】:

我的 RadioButtonList 的代码如下:

<div style="margin-top:5px"><asp:RadioButtonList ID="RadioButtonList6" RepeatColumns = "2" RepeatDirection="Vertical" RepeatLayout="Table"  runat="server">
    <asp:ListItem ValidationGroup="Curriculum" style="margin-right:12px; margin-top:-10px" >Si</asp:ListItem>
    <asp:ListItem ValidationGroup="Curriculum" >No</asp:ListItem></asp:RadioButtonList></div>
    <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator1" 
    ControlToValidate="RadioButtonList6" Text="Elige una opción" 
    ValidationGroup="Curriculum">
    </asp:RequiredFieldValidator>

它工作得很好,问题是,当转到另一个页面时,如果我单击返回,单选按钮保持选中状态,当我返回表单时,我需要它们后退或“刷新”,只是为了清楚,我的表单是 9 页的,所以当用户点击完成后它会转到另一个页面,但如果用户想返回,它似乎仍处于选中状态。

我该如何解决这个问题?

我希望我已经解释了自己,提前谢谢!

【问题讨论】:

  • 嗯,是的,有文本框,但我可以编辑它们,所以我认为那里没问题。
  • 你能不能只写一些像 RadioButtonList6.SelectedIndex = -1;所以不会有任何选择...
  • 你的意思是关于类方法? @MishaZaslavsky
  • On code behind - c# code... 其中方法 OnLoad 或 Init 方法(如果存在)

标签: c# asp.net .net sql-server visual-studio


【解决方案1】:

你可以使用 RadioButtonList.SelectedIndex=-1 单选按钮列表的属性如下所列 使用这个链接 http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.radiobuttonlist.aspx

【讨论】:

  • 非常感谢您提供的文档!它现在有效,但深入了解概念总是好的。
猜你喜欢
  • 1970-01-01
  • 2023-01-17
  • 2012-06-20
  • 2012-02-22
  • 1970-01-01
  • 1970-01-01
  • 2011-03-05
  • 1970-01-01
  • 2011-06-11
相关资源
最近更新 更多