When I select the "Columns" sub-menu of the Header Context Menu, it shows a list of all the columns exactly the way each column appears in the header of my grid. But many of my column headers are stacked type, sometimes 3 or 4 lines high, and, unfortunately, they're broken the same way in the "Columns" sub-menu, which looks bad and is difficult for the user to understand and use. Is there any way to change the type that appears in the sub-menu? I would like each column name to appear on one line in order to make the sub-menu more user friendly.
Thanks,
Tim
Thanks,
Tim
4 Answers, 1 is accepted
0
Hi Tim,
Please review this help topic for more information on how you can customize the grid HeaderContextMenu. Give it a try and let me know if any questions arise.
Kind regards,
Iana
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Please review this help topic for more information on how you can customize the grid HeaderContextMenu. Give it a try and let me know if any questions arise.
Kind regards,
Iana
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Tim
Top achievements
Rank 1
answered on 09 Oct 2009, 11:21 PM
lana,
Thanks for the response. Based on the help topic you recommended and a few others as well, I've cobbled together some code and feel like I'm getting closer, but I'm still unable to achieve what I'm looking for. Here is the code I have so far:
Based on checking values in the debugger, I seem to be reaching the proper item in the "Columns" submenu (when I use ".Value" in the if-statement, not the ".Text" that is there now), but I don't seem to be able to get to the actual text that appears in the menu. What would be the proper "menu.Items[topTierIndex].Items[columnsTierIndex]. -- " to use to change that text? I need to be able to change how it appears in the menu without changing how it appears in the grid column headers. Any additional help would be greatly appreciated.
Thanks,
Tim
Thanks for the response. Based on the help topic you recommended and a few others as well, I've cobbled together some code and feel like I'm getting closer, but I'm still unable to achieve what I'm looking for. Here is the code I have so far:
| protected override void OnPreRenderComplete(EventArgs e) |
| { |
| RadContextMenu menu = RadGrid1.HeaderContextMenu; |
| for (int topTierIndex = 0; topTierIndex < menu.Items.Count; topTierIndex++) |
| { |
| if (menu.Items[topTierIndex].Text == "Columns") |
| { |
| var columnsSubmenuItemsCount = menu.Items[topTierIndex].Items.Count; |
| for (int columnsTierIndex = 0; columnsTierIndex < columnsSubmenuItemsCount; columnsTierIndex++) |
| { |
| if (menu.Items[topTierIndex].Items[columnsTierIndex].Text == "Existing Menu Type for Menu Item 1") |
| { |
| menu.Items[topTierIndex].Items[columnsTierIndex].Text = "Replaced Menu Type for Menu Item 1"; |
| } |
| } |
| } |
| } |
| base.OnPreRenderComplete(e); |
| } |
Based on checking values in the debugger, I seem to be reaching the proper item in the "Columns" submenu (when I use ".Value" in the if-statement, not the ".Text" that is there now), but I don't seem to be able to get to the actual text that appears in the menu. What would be the proper "menu.Items[topTierIndex].Items[columnsTierIndex]. -- " to use to change that text? I need to be able to change how it appears in the menu without changing how it appears in the grid column headers. Any additional help would be greatly appreciated.
Thanks,
Tim
0
Hi Tim,
In order to change the Text shown in the Columns sub menu, you might need to find the CheckBox controls there and change their Text instead. Could you please try modifying your code as below and see if it makes any difference:
Best wishes,
Iana
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
In order to change the Text shown in the Columns sub menu, you might need to find the CheckBox controls there and change their Text instead. Could you please try modifying your code as below and see if it makes any difference:
protected override void OnPreRenderComplete(EventArgs e) { RadContextMenu menu = RadGrid1.HeaderContextMenu; for (int topTierIndex = 0; topTierIndex < menu.Items.Count; topTierIndex++) { if (menu.Items[topTierIndex].Text == "Columns") { var columnsSubmenuItemsCount = menu.Items[topTierIndex].Items.Count; for (int columnsTierIndex = 0; columnsTierIndex < columnsSubmenuItemsCount; columnsTierIndex++) { CheckBox cb = menu.Items[topTierIndex].Items[columnsTierIndex].Controls[0] as CheckBox; if (cb.Text == "Existing Menu Type for Menu Item 1") { cb.Text = "Replaced Menu Type for Menu Item 1"; } } } } base.OnPreRenderComplete(e); }Best wishes,
Iana
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Tim
Top achievements
Rank 1
answered on 13 Oct 2009, 06:16 AM
Iana,
Your code worked perfectly. The Columns sub-menu now looks exactly like I wanted. Thanks so much for the fast and helpful response.
Cheers,
Tim
Your code worked perfectly. The Columns sub-menu now looks exactly like I wanted. Thanks so much for the fast and helpful response.
Cheers,
Tim