Using Findcontrol to search for a control inside a gridview templa

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?U2F2dm91bGlkaXMgSW9yZGFuaXM=?=

    Using Findcontrol to search for a control inside a gridview templa

    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?
  • vijeta

    #2
    Re: Using Findcontrol to search for a control inside a gridviewtempla

    Suppose ur .aspx code goes like dis:
    <asp:GridView ID="GridView1" runat="server"
    OnRowDataBound= "GridView1_RowD ataBound">
    <Columns>
    <asp:TemplateFi eld>
    <ItemTemplate >
    <asp:Panel ID="p1" runat="server">
    <asp:GridView ID="GridView2" runat="server">
    </asp:GridView>
    </asp:Panel>
    </ItemTemplate>
    </asp:TemplateFie ld>
    </Columns>
    </asp:GridView>

    The RowDataBound event wl have the following code:

    protected void GridView1_RowDa taBound(object sender,
    GridViewRowEven tArgs e)
    {
    GridView gv2 = (GridView)e.Row .FindControl("G ridView2");

    }

    Thanks,

    Vijeta

    Comment

    Working...