Hi All,
Iam using two levels of hireachy in the Grid. The main Grid is RadGrid and SubGrid is RadGrid. Inside this SubGrid I have one more RadGrid. On the ItemCommand event how to identify the Grid
Can any one pls let me know.
Its very Urgent.
Regards
asra
Iam using two levels of hireachy in the Grid. The main Grid is RadGrid and SubGrid is RadGrid. Inside this SubGrid I have one more RadGrid. On the ItemCommand event how to identify the Grid
Can any one pls let me know.
Its very Urgent.
Regards
asra
7 Answers, 1 is accepted
0
Hello Asra,
I'm not sure if I understand your scenario completely. If you have multiple (nested) RadGrids and they share the same ItemCommand handler, you may try the following approach:
Kind regards,
Daniel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
I'm not sure if I understand your scenario completely. If you have multiple (nested) RadGrids and they share the same ItemCommand handler, you may try the following approach:
| protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) |
| { |
| string ownerGrid = e.Item.OwnerGridID; |
| } |
Kind regards,
Daniel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Asra
Top achievements
Rank 1
answered on 15 Jun 2009, 04:09 AM
Hi,
Thnx for your reply.
Iam just trying to replicate the demo HireachyTemplate of RadGrid. On the top of the Grid i have a button. On the click of this button i should be able to expand the Grid. Iam not able to find the InnerRadGrid on the Click of button.
For this iam writing like
RadGrid rgd=(RadGrid)RadGrid1.MasterTableView.FindControl("InnerGrid");
but the above code is not able to find the Grid.
One more button is there, on the click of that button a column of the grid should be visible true or false. This Iam handling in JavaScript. But iam not able to find the Id of the Inner Grid.
Can you pls let me know how to find the id of the InnerGrid using JavaScript. and aslo how to find the InnerGrid on the click of button.
Thnx for your reply.
Iam just trying to replicate the demo HireachyTemplate of RadGrid. On the top of the Grid i have a button. On the click of this button i should be able to expand the Grid. Iam not able to find the InnerRadGrid on the Click of button.
For this iam writing like
RadGrid rgd=(RadGrid)RadGrid1.MasterTableView.FindControl("InnerGrid");
but the above code is not able to find the Grid.
One more button is there, on the click of that button a column of the grid should be visible true or false. This Iam handling in JavaScript. But iam not able to find the Id of the Inner Grid.
Can you pls let me know how to find the id of the InnerGrid using JavaScript. and aslo how to find the InnerGrid on the click of button.
0
Hello Asra,
You can test my suggestion on the Hierarchy with Templates demo.
Server-side:
Client-side:
Best regards,
Daniel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
You can test my suggestion on the Hierarchy with Templates demo.
Server-side:
| protected void Button1_Click(object sender, EventArgs e) |
| { |
| foreach (GridNestedViewItem item in RadGrid1.MasterTableView.GetItems(GridItemType.NestedView)) |
| { |
| RadGrid ordersGrid = item.FindControl("OrdersGrid") as RadGrid; |
| if (ordersGrid != null) |
| ;//do something |
| } |
| } |
Client-side:
| <script type="text/javascript"> |
| function findNestedGrid() |
| { |
| var outerGrid = $find('<%= RadGrid1.ClientID %>'); |
| var dataItems = outerGrid.get_masterTableView().get_dataItems(); |
| for (var item = 0; item < dataItems.length; item++) |
| { |
| var nextSibling = dataItems[item].get_element().nextSibling; |
| if (!nextSibling) continue; |
| var nestedGrid = $telerik.findControl(nextSibling, "OrdersGrid"); |
| if(nestedGrid) alert(nestedGrid.get_id()); |
| } |
| } |
| </script> |
Best regards,
Daniel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Asra
Top achievements
Rank 1
answered on 18 Jun 2009, 01:55 PM
Hi Daniel,
Thanks for providing the code to access the inner grid.
We used the code, which as been provide by you to hide the columns of Inner Grid, as shown below ..
nestedGrid.get_masterTableView().showColumn(4); But we are unable to show column 4 of the inner grid.
Could you please, help us in resolving this issue.
We are current blogged with this, So could you please provide the solution ASAP.
Thanks & Regards,
ASRA
Thanks for providing the code to access the inner grid.
We used the code, which as been provide by you to hide the columns of Inner Grid, as shown below ..
nestedGrid.get_masterTableView().showColumn(4); But we are unable to show column 4 of the inner grid.
Could you please, help us in resolving this issue.
We are current blogged with this, So could you please provide the solution ASAP.
Thanks & Regards,
ASRA
| function findNestedGrid() |
| { |
| var outerGrid = $find('<%= RadGrid1.ClientID %>'); |
| var dataItems = outerGrid.get_masterTableView().get_dataItems(); |
| for (var item = 0; item < dataItems.length; item++) |
| { |
| var nextSibling = dataItems[item].get_element().nextSibling; |
| if (!nextSibling) continue; |
| var nestedGrid = $telerik.findControl(nextSibling, "OrdersGrid"); |
| if(nestedGrid) |
| { |
| nestedGrid.get_masterTableView().showColumn(4); //We are not able to show column 4 |
| } |
| } |
| } |
0
Hello Asra,
I suppose you provided wrong column index to the showColumn method. Please note that in this case the fourth column is GridCalculatedColumn (Order Total).
Hope this helps
Regards,
Daniel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
I suppose you provided wrong column index to the showColumn method. Please note that in this case the fourth column is GridCalculatedColumn (Order Total).
| <telerik:GridCalculatedColumn UniqueName="Total" DataFields="Total" Expression="{0}" |
| HeaderText="Order Total" DataType="System.Double" DataFormatString="{0:C}" Display="false"> |
| </telerik:GridCalculatedColumn> |
| </Columns> |
| if (nestedGrid) |
| { |
| nestedGrid.get_masterTableView().showColumn(4); |
| } |
| } |
Hope this helps
Regards,
Daniel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Asra
Top achievements
Rank 1
answered on 22 Jun 2009, 11:40 AM
Hi Daniel,
Firstly let me thankyou for your reply.
But my grid column is not GridCalcaultedColumn. Its a bound column only.
nestedGrid.get_masterTableView().showColumn(4), when iam uisng this showcolumn it is givng me error as Undefined Column.
even if i give the column index as 1, it is giving me error.
Can you pls help me out . This is only issue for which i got blocked.
Reqeust you respond ASAP.
Regards,
asra
Firstly let me thankyou for your reply.
But my grid column is not GridCalcaultedColumn. Its a bound column only.
nestedGrid.get_masterTableView().showColumn(4), when iam uisng this showcolumn it is givng me error as Undefined Column.
even if i give the column index as 1, it is giving me error.
Can you pls help me out . This is only issue for which i got blocked.
Reqeust you respond ASAP.
Regards,
asra
0
Hello Asra,
I noticed that you have opened a support ticket related to the same subject. Please attach a runnable version of your project (preferably a stripped one) and I will modify the code for you.
Regards,
Daniel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
I noticed that you have opened a support ticket related to the same subject. Please attach a runnable version of your project (preferably a stripped one) and I will modify the code for you.
Regards,
Daniel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.