Hello,
I have a Radgrid with another radgrid in an Editform template.
An example of the structure below:
Radgrid1
Editform Template
RadTab/multipage
Radgrid2
Master Table
Detail1
Detail2
I have a number things which I want to do server-side on the Details2 grid such as inserting footer fields, changing row colors etc.
How do I access the Radgrid2 and children server side (only Radgrid1 appears as a directly accessable object).
I'm new to ASP.Net programming so I'm probably missing something obvious. I'm used to dropping in a control and then being able to program against it server side immediately.
Thanks
Robert
I have a Radgrid with another radgrid in an Editform template.
An example of the structure below:
Radgrid1
Editform Template
RadTab/multipage
Radgrid2
Master Table
Detail1
Detail2
I have a number things which I want to do server-side on the Details2 grid such as inserting footer fields, changing row colors etc.
How do I access the Radgrid2 and children server side (only Radgrid1 appears as a directly accessable object).
I'm new to ASP.Net programming so I'm probably missing something obvious. I'm used to dropping in a control and then being able to program against it server side immediately.
Thanks
Robert
5 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 30 Dec 2011, 06:47 AM
Hello Robert,
Try the following code.
C#:
-Shinu.
Try the following code.
C#:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e){ if (e.Item is GridEditableItem && e.Item.IsInEditMode) { GridEditableItem item = (GridEditableItem)e.Item; RadPageView page = (RadPageView)item.FindControl("RadPageView1"); RadGrid grid=(RadGrid) page.FindControl("RadGrid2"); }}-Shinu.
0
Jayesh Goyani
Top achievements
Rank 2
answered on 30 Dec 2011, 07:30 AM
Hello,
After getting the grid you can access Detail table view by below code
Thanks,
Jayesh Goyani
After getting the grid you can access Detail table view by below code
// Method 1 foreach (GridDataItem item in RadGrid1.MasterTableView.Items) { if (item.HasChildItems) { // if Detail1 and Detail2 are in same level // for Detail1 foreach (GridDataItem citem in item.ChildItem.NestedTableViews[0].Items) { } //for Detail2 foreach (GridDataItem citem in item.ChildItem.NestedTableViews[1].Items) { } //OR // if Detail1 and Detail2 are NOT in same level // for Detail1 foreach (GridDataItem citem in item.ChildItem.NestedTableViews[0].Items) { if (item.HasChildItems) { //for Details foreach (GridDataItem citem2 in citem.ChildItem.NestedTableViews[0].Items) { } } } } } // Method 2 foreach (GridDataItem item in RadGrid1.MasterTableView.Items) { // please give different for MasterTableView,DeTailTable if (item.OwnerTableView.Name == "GridName") { } }Thanks,
Jayesh Goyani
0
Robert
Top achievements
Rank 1
answered on 31 Dec 2011, 03:50 AM
Thanks Shinu,
I'm using VB and using your code can find Radgrid6 however how do I access the details tables.
As below on the 6th line of code I try to access the nested table view but "grid.MasterTableView.Items[0]" expects an identifier and "[0]" creates an error).
Thanks a lot
Robert
I'm using VB and using your code can find Radgrid6 however how do I access the details tables.
As below on the 6th line of code I try to access the nested table view but "grid.MasterTableView.Items[0]" expects an identifier and "[0]" creates an error).
Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then Dim item As GridEditableItem = DirectCast(e.Item, GridEditableItem) Dim page As RadPageView = DirectCast(item.FindControl("RadPageView5"), RadPageView) Dim grid As RadGrid = DirectCast(page.FindControl("RadGrid6"), RadGrid) Dim nestedTableView as GridTableView = CType(grid.MasterTableView.Items[0], GridDataItem).ChildItem.NestedTableViews[0] End IfEnd SubThanks a lot
Robert
0
Robert
Top achievements
Rank 1
answered on 31 Dec 2011, 04:03 AM
Thanks Jasesh,
However I'm looking to access the children to a radgrid sitting in the editform template of Radgrid1 rather than the children of radgrid1 it self. I've managed to access these using the code here: http://www.telerik.com/help/aspnet-ajax/grid-traversing-detail-tables-items-in-grid.html
Cheers
Robert
However I'm looking to access the children to a radgrid sitting in the editform template of Radgrid1 rather than the children of radgrid1 it self. I've managed to access these using the code here: http://www.telerik.com/help/aspnet-ajax/grid-traversing-detail-tables-items-in-grid.html
Cheers
Robert
0
Ramya
Top achievements
Rank 1
answered on 04 Jan 2018, 12:21 PM
I have a RadGrid which has rows but when I try to read the rows in server side using following code, RadGridARSearch.MasterTableView.Items count is always zero. But Grid has one row with the checkbox checked.
foreach (GridDataItem item in RadGridARSearch.MasterTableView.Items)
{
CheckBox chk = (CheckBox)item["ClientSelectColumn"].Controls[0];
FYI..
I tried even
<telerik:RadAjaxManagerProxy ID="AjaxManagerProxy1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="divFormatID">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="divFormatID" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManagerProxy>
Can u help on this?