I want to
disable the gridview checkboxes which is inside gridview.
I tried like below:-
public static void DisableFormControls(ControlCollection ChildCtrls)
{
foreach (Control Ctrl in ChildCtrls)
{
if (Ctrl is Obout.Grid.Grid)
((Obout.Grid.Grid)Ctrl).Enabled = false;
if (Ctrl is HtmlGenericControl)
((HtmlGenericControl)Ctrl).Disabled = true;
}
}
and on Page_load
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["userid"] != null && Request.QueryString["userid"] != "")
{
Hid_userid.Value = Request.QueryString["userid"];
Hid_HR.Value = "Y";
FundiableEnable();
DisableFormControls(Form.Controls);
}
}
But it is not working for me. Any idea what's wrong with the code
Here is my html of GridView:
<cc1:Grid ID="GrdWorkingCompany" runat="server" EnableTypeValidation="true" CallbackMode="true"
ShowFooter="false" AutoGenerateColumns="false" AllowAddingRecords="true" AllowSorting="false"
Width="100%" FolderStyle="~/Styles/Grid/style_12" PageSize="18">
<Columns>
<cc1:Column ID="Sr_No" ReadOnly="true" DataField="SrNo" HeaderText="Sr.No." Width="50px">
</cc1:Column>
<cc1:Column ID="Points" ReadOnly="true" DataField="Points" HeaderText="Points" runat="server" Width="300px">
</cc1:Column>
<cc1:Column ID="chkPoor" ReadOnly="true" DataField="Rating1" HeaderText="Poor" Width="110px" TemplateId="tpltPoor">
</cc1:Column>
<cc1:Column ID="chkSatisfactory" DataField="Rating2" HeaderText="Satisfactory" ReadOnly="true"
Width="110px" TemplateId="tpltSatisfactory">
</cc1:Column>
<cc1:Column ID="chkGood" ReadOnly="true" HeaderText="Good" DataField="Rating3" Width="110px" TemplateId="tpltGood">
</cc1:Column>
<cc1:Column ID="chkExcellent" HeaderText="Excellent" DataField="Rating4" Width="110px" ReadOnly="true"
TemplateId="tpltEx1">
</cc1:Column>
</Columns>
<TemplateSettings GroupHeaderTemplateId="GroupTemplate" />
<Templates>
<cc1:GridTemplate runat="server" ID="GridTemplate2">
<Template>
<%# Container.Column.HeaderText %>
: <i>
<%# Container.Value %></i> (<%# Container.Group.PageRecordsCount %><%# Container.Group.PageRecordsCount > 1 ? "records" : "record" %>)
</Template>
</cc1:GridTemplate>
</Templates>
<Templates>
<cc1:GridTemplate ID="tpltPoor">
<Template>
<input type="checkbox" id="chkA1<%# (Container.RecordIndex)%>" name="chkAC1" style="width: 17px;
height: 17px;" value="<%# (Container.RecordIndex)%>" onclick="AppoveCheckA(this)" /></Template>
</cc1:GridTemplate>
<cc1:GridTemplate ID="tpltSatisfactory">
<Template>
<input type="checkbox" id="chkA2<%# (Container.RecordIndex) %>" name="chkAC2" style="width: 17px;
height: 17px;" value="<%# (Container.RecordIndex)%>" onclick="AppoveCheckA(this)" /></Template>
</cc1:GridTemplate>
<cc1:GridTemplate ID="tpltGood">
<Template>
<input type="checkbox" id="chkA3<%# (Container.RecordIndex) %>" name="chkAC3" style="width: 17px;
height: 17px;" value="<%# (Container.RecordIndex)%>" onclick="AppoveCheckA(this)" /></Template>
</cc1:GridTemplate>
<cc1:GridTemplate ID="tpltEx1">
<Template>
<input type="checkbox" id="chkA4<%# (Container.RecordIndex) %>" name="chkAC4" style="width: 17px;
height: 17px;" value="<%# (Container.RecordIndex)%>" onclick="AppoveCheckA(this)" /></Template>
</cc1:GridTemplate>
</Templates>
</cc1:Grid>