2013-06-12 57 views
0

MY TABLE:与ASP.net禁用表控制&Telerik控制

<table id="DispalyTable" border="4px" style="width: 100%;" > 
         <tr> 
          <td style="width: 137px; height: 137px;" valign="top"> 
           <telerik:RadGrid runat="server"> 
            <MasterTableView> 
             <Columns> 
              <telerik:GridTemplateColumn> 
               <HeaderTemplate> 
                <asp:CheckBox runat="server" Checked="true" Text="ALL" /> 
               </HeaderTemplate> 
               <ItemTemplate> 
                <asp:CheckBox runat="server" /> 
               </ItemTemplate> 
              </telerik:GridTemplateColumn> 
             </Columns> 
            </MasterTableView> 
           </telerik:RadGrid> 
          </td> 
          <td style="width: 130px;" valign="top"> 
           <div> 
            <input id="Alloption" type="checkbox" checked="checked" value="All" onchange="javascript:othercheckboxalloption();" style="color: Black" 
             /><span style="color: Black">All </span> 
            <br /> 
            <input id="otherCheckbox2" type="checkbox" value="Accepted" style="color: Black" 
             class="chkdisplay" onchange="javascript:othercheckbxdisplay();" /><span style="color: Black">Accepted </span> 
            <br /> 
            <input id="otherCheckbox3" type="checkbox" value="Contracted" style="color: Black" 
             class="chkdisplay" onchange="javascript:othercheckbxdisplay();" /><span style="color: Black">Contracted</span> 
            <br /> 
            <input id="otherCheckbox4" type="checkbox" value="Pending" style="color: Black" class="chkdisplay" onchange="javascript:othercheckbxdisplay();" /><span 
             style="color: Black">Pending</span> 
            <br /> 
            <input id="otherCheckbox5" type="checkbox" value="Pre-Authorized" style="color: Black" 
             class="chkdisplay" onchange="javascript:othercheckbxdisplay();" /><span style="color: Black">Pre-Authorized</span> 
            <br /> 
            <input id="otherCheckbox6" type="checkbox" value="Show Deleted" style="color: Black" 
             class="chkdisplay" onchange="javascript:othercheckbxdisplay();" /><span style="color: Black">Show Deleted</span> 
            <br /> 
            <input id="otherCheckbox7" type="checkbox" value="Treated" style="color: Black" class="chkdisplay" onchange="javascript:othercheckbxdisplay();" /><span 
             style="color: Black">Treated</span> 
            <br /> 
            <%-- <asp:CheckBox ID="All" runat="server" Checked="true" Text="ALL" ForeColor="Black" /><br /> 

           </div> 
          </td> 
          <td style="width: 138px;" valign="top"> 
           <div> 
            <asp:CheckBox ID="CheckBox8" runat="server" Checked="true" Text="Accepted" ForeColor="Black" /><br /> 
            <asp:CheckBox ID="CheckBox9" runat="server" Checked="false" Text="Appointment" ForeColor="Black" /><br /> 
            <asp:CheckBox ID="CheckBox10" runat="server" Checked="true" Text="Contract #" ForeColor="Black" /><br /> 
            <asp:CheckBox ID="CheckBox11" runat="server" Checked="true" Text="Pre-Auth #" ForeColor="Black" /><br /> 
            <asp:CheckBox ID="CheckBox12" runat="server" Checked="true" Text="TX Coloums" ForeColor="Black" /><br /> 
           </div> 
          </td> 
          <td valign="top"> 
           <div> 

            <asp:DropDownList ID="DropDownList1" runat="server" > 
             <asp:ListItem Text="Diag Date,Tth,Proc" Value="Diag Date,Tth,Proc"></asp:ListItem> 
             <asp:ListItem Text="Tth,Diag Date,Proc" Value="Tth,Diag Date,Proc"></asp:ListItem> 
            </asp:DropDownList> 
           </div> 
          </td> 
         </tr> 
        </table> 

代码I尝试:

在其上述函数被调用
function notewizardcheckbox() { 
      $("#DispalyTable").attr("disabled", "disabled"); 
     } 

控制,onchange事件

<div style=" margin-left:25px; margin-top:17px; float:none;"> 
       <input id="Checkbox1" type="checkbox" value="Note Wizard View" onchange="javascript:notewizardcheckbox();" /><span 
            style="color: Blue; font-size:21px; margin-left:6px;" >Note Wizard View</span> 
       </div> 
+0

当你说“禁用表”,你的意思是“禁用该表内的所有表单元素”? (实际上'

'元素并不真正有禁用或启用的概念。) – nnnnnn

+0

@nnnnnYes禁用表 –

回答

1

禁用所有窗体控件中,你可以做到这一点的表:

$('#DispalyTable :input').prop('disabled', true); 

:input selector将选择输入,文本区域,选择和按钮元素。

如果Telerik的/ .NET控件不“正常”的HTML表单元素,但他们有一个disabled属性,那么你可以试试这个:

$('#DispalyTable td').find('*').prop('disabled', true); 

也就是说,选择元素所有内表中的单元格并将其设置为disabledtrue(尽管这对其中一些可能没有意义)。

+0

我试过了,但只有与输入控件被禁用,但不是我的telerik和asp.net控件 –

+0

我已经更新了我的答案,提出了第二种选择。 – nnnnnn

+0

感谢你的rply.you说的是对的,但我怎么能禁用telerik,asp.net controls.Is没有办法一次直接禁用整个表 –

1

这个jQuery将禁用'#DispalyTable'div内的所有输入元素。

$('#DispalyTable input').each(function(){ 
    $(this).attr('disabled','disabled'); 
} 
+0

中的所有内容我尝试过,但只有输入的控件被禁用,但不是我的telerik和asp.net控件 –

+0

你能看看/共享您的telerik&asp.net控件导致问题的呈现的HTML? – Paritosh

+0

有没有办法一次直接禁用整个表 –