Using Findcontrol to search for a control inside a gridview templa

  • Thread starter Thread starter Savvoulidis Iordanis
  • Start date Start date
S

Savvoulidis Iordanis

How can I use Findcontrol inside a master gridview's RowDatabound event to
search for another gridview (detail) control that is inside an ASP Panel, in
a template column of the master gridview?
 
Suppose ur .aspx code goes like dis:
<asp:GridView ID="GridView1" runat="server"
OnRowDataBound="GridView1_RowDataBound">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Panel ID="p1" runat="server">
<asp:GridView ID="GridView2" runat="server">
</asp:GridView>
</asp:Panel>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

The RowDataBound event wl have the following code:

protected void GridView1_RowDataBound(object sender,
GridViewRowEventArgs e)
{
GridView gv2 = (GridView)e.Row.FindControl("GridView2");

}

Thanks,

Vijeta
 
Back
Top