3 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 01 Mar 2010, 10:50 AM
Hi,
You can access the selected item value using the code snippet below:
string categoryName= RadGrid1.SelectedValues["CategoryName"].ToString();
In case you want to access the RadTabstrip for each item
| foreach (GridDataItem dataItem in RadGrid1.SelectedItems) |
| { |
| string selectedValue = dataItem.GetDataKeyValue("CategoryName").ToString(); |
| RadTabStrip tabStrip = (RadTabStrip)dataItem.FindControl("RadTabStrip1"); |
| } |
Hope this helps.
Thanks,
Princy
0
mk
Top achievements
Rank 1
answered on 01 Mar 2010, 03:34 PM
Thanks Princy for the snippet.
This is how my structure is defined in aspx.
<RadGrid1>
<NestedViewTemplate>
<RadGrid2>
<NestedViewTemplate>
<RadTabStrip ..... />
</NestedViewTemplate>
</RadGrid2>
</NestedViewTemplate>
</RadGrid1>
So, what method should I use to populate the child control ( RadGrid2 and its child contol RadTabStrip ) . Is there a sample out there somewhere that I can look at .
Also, is it possible to completely build this structure programmatically. I was able to build a similar structure with RadGrid ( DetailTable ) but was unable to add RadTabStrip control and had to only work with RadGrid.
Thanks again for the quick response.
This is how my structure is defined in aspx.
<RadGrid1>
<NestedViewTemplate>
<RadGrid2>
<NestedViewTemplate>
<RadTabStrip ..... />
</NestedViewTemplate>
</RadGrid2>
</NestedViewTemplate>
</RadGrid1>
So, what method should I use to populate the child control ( RadGrid2 and its child contol RadTabStrip ) . Is there a sample out there somewhere that I can look at .
Also, is it possible to completely build this structure programmatically. I was able to build a similar structure with RadGrid ( DetailTable ) but was unable to add RadTabStrip control and had to only work with RadGrid.
Thanks again for the quick response.
0
Princy
Top achievements
Rank 2
answered on 02 Mar 2010, 06:02 AM
Hi,
Please try the code snippet below to access the nested RadGrid and RadTabstrip and set the datasource accordingly:
| protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) |
| { |
| if(e.CommandName=="ExpandCollapse") |
| { |
| GridDataItem dataItem=(GridDataItem)e.Item; |
| GridItem[] nestedViewItems = dataItem.OwnerTableView.GetItems(GridItemType.NestedView); |
| foreach (GridNestedViewItem nestedViewItem in nestedViewItems) |
| { |
| RadGrid grid2 = (RadGrid)nestedViewItem.FindControl("RadGrid2"); |
| GridItem[] nestedViewItems1 = grid2.MasterTableView.GetItems(GridItemType.NestedView); |
| foreach (GridNestedViewItem nestedViewItem1 in nestedViewItems1) |
| { |
| RadTabStrip RadTabStrip2 = (RadTabStrip)nestedViewItem1.FindControl("RadTabStrip2"); |
| RadTab tab = new RadTab(dataItem.GetDataKeyValue("CategoryName").ToString()); |
| RadTabStrip2.Tabs.Add(tab); |
| } |
| } |
| } |
| } |
Hope this helps.
Thanks.
Princy