This is a migrated thread and some comments may be shown as answers.

Display a 2nd grid from a button in a grid

2 Answers 87 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris @ Intrinsic
Top achievements
Rank 1
Chris @ Intrinsic asked on 21 Jan 2011, 12:00 AM

In a radgrid,   I want to have a button in the grid to display another grid if I click it (so i can edit a linked table that is linked to the table that is bound to the grid.)  First I have the 2nd grid in a panel that I hide initially.  But, right now it is not displaying it, only when I click the button on the grid twice does it actually show the 2nd grid!    Do you have any sample code that would help?

Thank you.


2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 21 Jan 2011, 09:20 AM
Hello,

Here is a sample code snippet to achieve your requirement. Hope it helps.

ASPX:
<asp:Panel ID="Panel1" runat="server" Visible="false">
    <telerik:RadGrid ID="RadGrid1" runat="server"  DataSourceID="SqlDataSource1">
      .   .    .   .    .   .   .
    </telerik:RadGrid>
</asp:Panel>
<telerik:RadGrid ID="RadGrid2" runat="server" DataSourceID="SqlDataSource2"
    OnItemCommand="RadGrid2_ItemCommand">
    <MasterTableView CommandItemDisplay="Top" DataKeyNames="EmployeeID" EditMode="InPlace">
       
        <Columns>
            <telerik:GridTemplateColumn>
                <ItemTemplate>
                    <asp:Button ID="Button1" runat="server" Text="Button" CommandName="show" />
                </ItemTemplate>
            </telerik:GridTemplateColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

C#:
protected void RadGrid2_ItemCommand(object sender, GridCommandEventArgs e)
   {
       if (e.CommandName == "show")
       {
            Panel1.Visible = true;
       }
   }

Thanks,
Princy.
0
Chris @ Intrinsic
Top achievements
Rank 1
answered on 21 Jan 2011, 06:46 PM
Thanks.  The forum and support here are great!
Tags
Grid
Asked by
Chris @ Intrinsic
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Chris @ Intrinsic
Top achievements
Rank 1
Share this question
or