使用ASP.net控件禁用表&Telerik控制

Disable table with ASP.net controls & Telerik controls

本文关键字:Telerik 控制 ASP net 控件 使用      更新时间:2023-09-26

MY TABLE:

<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 Tried:

 function notewizardcheckbox() {
            $("#DispalyTable").attr("disabled", "disabled");
        }
控件,onchange event
<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>

要禁用表格中的所有表单控件,可以这样做:

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

:input选择器将选择input, textarea, select和button元素。

如果Telerik/.Net控件不是"正常的"html表单元素,但它们有一个disabled属性,那么你可以试试这个:

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

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

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

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