Reputation: 3511
I want to find control in my gridview.Template detail row by id
bool IsAllAud = false;
var item = (CheckBox)VendorsGrid.Templates.DetailRow.FindControl("CBIsAllAudience");
IsAllAud = item.Checked;
if (IsAllAud)
{
}
<dx:ASPxGridView ID="rt" ClientInstanceName="rt" runat="server"
AutoGenerateColumns="false" DataSourceID="rtt" KeyFieldName="ID" Width="100%">
<SettingsDetail AllowOnlyOneMasterRowExpanded="true" />
<Columns>
<dx:GridViewDataTextColumn FieldName="Name" Caption="Name" />
</Columns>
<Templates>
<DetailRow>
<asp:CheckBox ID="CBIsAllAudience" runat="server" />
...
Upvotes: 1
Views: 15708
Reputation: 21
In the control event Just write this code
{
for (int i = 0; i < gvVndInvoiceDevExp.VisibleRowCount ; i++)
{
GridViewDataColumn col1 = gvVndInvoiceDevExp.Columns[0] as GridViewDataColumn;
GridViewDataColumn col2 = gvVndInvoiceDevExp.Columns[8] as GridViewDataColumn;
CheckBox chk = gvVndInvoiceDevExp.FindRowCellTemplateControl(i, col1, "chk") as CheckBox;
ASPxCheckBox chkIsVal = gvVndInvoiceDevExp.FindRowCellTemplateControl(i, col2, "chkIsVal") as ASPxCheckBox;
if (chk.Checked == true)
{
chkIsVal.Enabled = true;
}
else
{
chkIsVal.Enabled = false;
}
}
}
Upvotes: 2
Reputation: 3917
Since this is DetailRow you will need to call ASPxGridView.FindDetailRowTemplateControl Method
var item = VendorsGrid.FindDetailRowTemplateControl(index, "CBIsAllAudience");
Upvotes: 2