I have issues setting a custom ITemplate implementation on RadMenuItems.
I populate the RadMenu using the DataSource property.
In which event during the databinding am I supposed to set the ItemTemplate property on the RadMenuItem (which gets created during the databinding process ... I populate the DataSource using custom data objects) so that it gets applied?
The second issue ... I only want to apply the custom ITemplate implementation for one level in the MenuItem hierarchy. The first level should use the default rendering, the second level should use a custom template.
I populate the RadMenu using the DataSource property.
In which event during the databinding am I supposed to set the ItemTemplate property on the RadMenuItem (which gets created during the databinding process ... I populate the DataSource using custom data objects) so that it gets applied?
The second issue ... I only want to apply the custom ITemplate implementation for one level in the MenuItem hierarchy. The first level should use the default rendering, the second level should use a custom template.
5 Answers, 1 is accepted
0
Hello,
Please check the following help articles about adding templates at run-time:
Templates Overview
Adding templates
you can set the template only for child items by checking the item level:
Hope this helps.
Regards,
Yana
the Telerik team
Please check the following help articles about adding templates at run-time:
Templates Overview
Adding templates
you can set the template only for child items by checking the item level:
TextBoxTemplate template =
new
TextBoxTemplate();
foreach
(RadMenuItem item
in
RadMenu1.GetAllItems())
{
if
(item.Level > 0)
template.InstantiateIn(item);
}
RadMenu1.DataBind();
Hope this helps.
Regards,
Yana
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Fire
Top achievements
Rank 1
answered on 18 Jan 2011, 02:24 PM
I saw that sample. That is not what I want, nor is it what I was asking for.
Which is why I asked for a sample using the DataSource Property "I populate the RadMenu using the DataSource property."
So again: I connect a DataSource implementatioin to the Radmenu instance using the DataSource property. How do I instantiate and assign the ITemplate implementation for the menu items?
In which event am I supposed to set the Itemplate?
Which is why I asked for a sample using the DataSource Property "I populate the RadMenu using the DataSource property."
So again: I connect a DataSource implementatioin to the Radmenu instance using the DataSource property. How do I instantiate and assign the ITemplate implementation for the menu items?
In which event am I supposed to set the Itemplate?
0
Hello,
I've attached a simple example with Northwind database to demonstrate the approach, please download it and give it a try.
Kind regards,
Yana
the Telerik team
I've attached a simple example with Northwind database to demonstrate the approach, please download it and give it a try.
Kind regards,
Yana
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Gian Carlo Zamboni
Top achievements
Rank 1
answered on 10 Aug 2011, 02:16 PM
The example code help me with the same problem, thanks. I think you should add to your documentation the line code "item.databind();" when using a datasource.
0
Hi Gian,
Thanks for the reasonable suggestion. We will review the documenation and make the needed improvements.
Regards,
Peter
the Telerik team
Thanks for the reasonable suggestion. We will review the documenation and make the needed improvements.
Regards,
Peter
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.