【问题标题】:All Radio button groups are click or not所有单选按钮组是否单击
【发布时间】:2011-07-11 20:59:31
【问题描述】:

在ascx用户控件中,有一个radiobuttonlist控件:

<asp:RadioButtonList ID="TrueFalse" runat="server" onclick="Radcheck();" 
                     Font-Bold="True"  RepeatDirection="Horizontal">
    <asp:ListItem Value="0">T</asp:ListItem> 
    <asp:ListItem Value="1">F</asp:ListItem>
</asp:RadioButtonList>

在 javascript 中,我想检查所有单选按钮列表控件是否被选中。 它将由一个 aspx 页面调用,该页面将具有多个单选按钮列表控件。 请找到解决方案。

【问题讨论】:

    标签: .net asp.net radiobuttonlist


    【解决方案1】:
    function Radcheck(){
      var areAllChecked = true;
      $('#<%=this.TrueFalse.CLientID%> :radio').each(function(){
         if(!this.checked){
           areAllChecked = false;
           return ;
         }
    
      });
    
      return areAllChecked;
    
    }
    

    【讨论】:

    • 编译错误描述:在编译服务此请求所需的资源时出错。请查看以下特定错误详细信息并适当修改您的源代码。编译器错误消息:CS0117:“ASP.controls_cps_truefalsecontrol_ascx”不包含“TrueFalse”的定义
    • 如果您的 js 代码在 apsx 页面中,您必须采取不同的方法,在您的用户控件中创建一个公共属性 ClientID 像这样 public string ClientId { get { return this.rueFalse.ClientID;}并像这样更改您的 js 代码 $('# :radio').each(function(){
    • Radiolist 控件即将推出,它在 datalist 控件下
    猜你喜欢
    • 2014-04-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-03
    • 1970-01-01
    • 1970-01-01
    • 2014-04-09
    相关资源
    最近更新 更多