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

radgrid2 nested in formtemplate of radgrid1 mastertablevieweditform (how do you bind data to radgrid2?)

2 Answers 44 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jon-Jon Kershaw
Top achievements
Rank 2
Jon-Jon Kershaw asked on 29 Dec 2008, 06:06 PM
I have radgrid1 that has an editable row that displays information in a formtemplate with table data with textboxes and comboboxes. Also in the formtemplate I have a radgrid called radgrid2.  I have the formtemplate populating the textboxes and comboboxes correctly, but how do I access radgrid2 within the formtemplate to bind data? 

If code is needed please let me know and I can provide.

Thanks in advance.

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 30 Dec 2008, 04:51 AM
Hi,

Try the following code snippet to access a Grid inside the FormTemplate.

ASPX:
 <EditFormSettings EditFormType="Template" > 
                <FormTemplate> 
                    <telerik:RadGrid ID="RadGrid2" runat="server"
                    </telerik:RadGrid> 
                </FormTemplate> 
              </EditFormSettings> 

CS:
  protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
       if (e.Item is GridEditableItem && e.Item.IsInEditMode) 
            { 
                GridEditableItem item = (GridEditableItem)e.Item; 
                RadGrid Grid2 = (RadGrid)item.FindControl("RadGrid2"); 
                Grid2.DataSourceID = "SqlDataSource1"
            } 
    } 


Thanks
Princy.
0
Jon-Jon Kershaw
Top achievements
Rank 2
answered on 05 Jan 2009, 05:15 PM
I haven't got my method to pull the data to test this but from testing in a seperate application it worked great.  Thanks much.
Tags
Grid
Asked by
Jon-Jon Kershaw
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Jon-Jon Kershaw
Top achievements
Rank 2
Share this question
or