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

Hierarchy rebind child

1 Answer 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Officialboss
Top achievements
Rank 1
Officialboss asked on 15 Sep 2008, 04:58 PM
I have a button in my first level child grid. Pressing the button calls a method that does an update in the table. How do I rebind or refresh the data in the child grid when the button is pressed.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 16 Sep 2008, 07:05 AM
Hello Howard,

You can try out the following code snippet to refresh the child grid on button click.

aspx:
 <DetailTables> 
        <telerik:GridTableView AutoGenerateColumns="true" Name="Detail" DataSourceID="SqlDataSource2" runat="server"
       <Columns> 
       <telerik:GridTemplateColumn UniqueName="RefreshChild"
       <ItemTemplate> 
           <asp:Button ID="Button2" CommandName="RebindGrid" runat="server" Text="Refresh" OnClick="Button2_Click" /> 
       </ItemTemplate> 
       </telerik:GridTemplateColumn> 
       </Columns> 
        </telerik:GridTableView> 
        </DetailTables>       

cs:
 protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
    { 
      if (e.CommandName == "RebindGrid") 
        { 
            if (e.Item.OwnerTableView.Name == "Detail") 
                e.Item.OwnerTableView.Rebind(); 
        } 
    } 

Thanks
Princy.
Tags
Grid
Asked by
Officialboss
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or