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

How to Bind Data To a RadGridWhich is Under Another RadGrid

1 Answer 25 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ranganath
Top achievements
Rank 1
Ranganath asked on 05 Sep 2008, 12:04 PM

HI,

I am trying to place a RadGrid under another RadGrid. But I am nt able to Bind the Data and fine the Ineer Controls of the inner Grid. Indetail

I Had One RadGrid1 & RadGrid3 and Under the RadGrid1 I placed RadGrid3 as follow.

But I am nt able to Bing the Date to the RadGrid3. Please Guide me how to Bind Data and Firing the event for Rad Controls which are under RadGrid3.

<telerik:RadGrid PageSize="3" AllowPaging="true" ID="RadGrid1" runat="server" GridLines="Horizontal" AllowFilteringByColumn="true" Skin="WebBlue" AllowAutomaticDeletes="True" OnNeedDataSource="RadGrid1_NeedDataSource"

>

<PagerStyle Mode="Slider" />

 <MasterTableView AutoGenerateColumns="false" DataKeyNames="TerritoryID" EditMode="EditForms" AllowMultiColumnSorting="true" CommandItemDisplay="TopAndBottom">

 <Columns><telerik:GridEditCommandColumn></telerik:GridEditCommandColumn>                            <telerik:GridBoundColumn ReadOnly="true" HeaderText="TerritoryID" DataField="TerritoryID" UniqueName="TerritoryID" />                            

<telerik:GridBoundColumn ReadOnly="false" HeaderText="TerritoryDescription" DataField="TerritoryDescription" UniqueName="TerritoryDescription" />                            <telerik:GridBoundColumn ReadOnly="false" HeaderText="RegionID" DataField="RegionID" UniqueName="RegionID" />                            <telerik:GridButtonColumn CommandName="Delete" Text="Delete">                            </telerik:GridButtonColumn>  </Columns>                        <EditFormSettings EditFormType="Template">                            <EditColumn UniqueName="EditCommandColumn1">                            </EditColumn><FormTemplate>

 <table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="1" rules="none" style="border-collapse: collapse">                                    <tr><td> <table id="Table3" cellspacing="1" cellpadding="1" width="100%" border="0">  <tr><td>                                                        TerritoryID: </td><td><asp:TextBox ID="txtTerritoryID" MaxLength="5" Visible='<% # (Container as GridItem).OwnerTableView.IsItemInserted %>'

runat="server"></asp:TextBox></td></tr><tr><td>TerritoryDescription:                                                    </td><td><asp:TextBox ID="txtTerritoryDescription" runat="server" Text='<%# Eval( "TerritoryDescription" ) %>'></asp:TextBox></td></tr><tr><td>                                                        RegionID: </td><td><td><telerik:RadGrid ID="RadGrid3" PageSize="3" AllowPaging="true" runat="server" GridLines="Horizontal"                                                            AllowFilteringByColumn="true" Skin="WebBlue" AllowAutomaticDeletes="True" OnNeedDataSource="RadGrid3_NeedDataSource"><PagerStyle Mode="Slider" /><MasterTableView AutoGenerateColumns="false" DataKeyNames="TerritoryID" EditMode="EditForms"                                                                AllowMultiColumnSorting="true" CommandItemDisplay="TopAndBottom">                                                                <Columns>                                                                    <telerik:GridEditCommandColumn>                                                                    </telerik:GridEditCommandColumn>                                                                    <telerik:GridBoundColumn ReadOnly="true" HeaderText="TerritoryID" DataField="TerritoryID" UniqueName="TerritoryID" />

<telerik:GridBoundColumn ReadOnly="false" HeaderText="TerritoryDescription" DataField="TerritoryDescription"                                                                        UniqueName="TerritoryDescription" />                                                                    <telerik:GridBoundColumn ReadOnly="false" HeaderText="RegionID" DataField="RegionID" UniqueName="RegionID" />                                                                    <telerik:GridButtonColumn CommandName="Delete" Text="Delete">                                                                    </telerik:GridButtonColumn> </Columns></MasterTableView>                                                      </telerik:RadGrid>

                                                   

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 08 Sep 2008, 06:48 AM
Hi Ranganath,

Try the following code in the ItemDataBound event of the RadGrid1.

if(e.Item is GridDataItem && e.Item.Edit) 
 { 
   RadGrid radgrid3= e.Item.FindControl("RadGrid3") as RadGrid; 
   radgrid3.Rebind(); 
 }

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