hi friends,
how can i find the Checkbox control which is inside the Gridview on TextChanged event of Textbox control.....the Checkbox & Textbox both are inside the gridview.
only that i have to find the related checkbox of that row on TextChanged event in that Row.
reply frnds!
Regards,
aamir
Loading
Rahul BhattPosted Jul 6, 2012, 3:09 AM
To Achieve this task,
Added on textChange event for texbox and set auto postback true
On text change event find row using NamingContainer after then find check box from that row.
TextBox txtGridtext = (TextBox)sender;
GridViewRow row = (GridViewRow)txtGridtext.NamingContainer;
CheckBox chk = (CheckBox)row.FindControl("chkList");
SOLUTION
Aspx Page
<asp:TemplateField HeaderText="test">
<ItemTemplate>
<asp:CheckBox ID="chkList" runat="server" />
ItemTemplate>
asp:TemplateField>
<asp:TemplateField HeaderText="PanelView">
<ItemTemplate>
<asp:TextBox ID="txtGridtext" OnTextChanged="txtGridtext_TextChanged" AutoPostBack="true" runat="server">asp:TextBox>
ItemTemplate>
asp:TemplateField>
C# Page
protected void txtGridtext_TextChanged(object sender, EventArgs e)
{
TextBox txtGridtext = (TextBox)sender;
GridViewRow row = (GridViewRow)txtGridtext.NamingContainer;
CheckBox chk = (CheckBox)row.FindControl("chkList");
chk.Checked = true;
}