2013-06-12 59 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

有沒有辦法一次直接禁用整個表 –