Using Findcontrol to search for a control inside a gridview templa

  • Thread starter Savvoulidis Iordanis
  • 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?
 
V

vijeta

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,060
Latest member
BuyKetozenseACV

Latest Threads

Top