After I update my trial version of the RadControls ASP.NET to the full version I started getting a JavaScript error ('childNodes' is null or not an object). Then I realized that it does not allow adding a RadMenu with no items. I'm adding an empty one to be actually created on the server-side.
I'm using the latest version of the RadControls ASPNET AJAX Q1 2009 (2009.1.402.35)
Here is the code which I could replicate the error:
| <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="TelerikTests2.WebForm1" %> |
| <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml" > |
| <head runat="server"> |
| <title></title> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> |
| </telerik:RadScriptManager> |
| <div> |
| <telerik:RadMenu ID="RadMenu1" runat="server"> |
| </telerik:RadMenu> |
| </div> |
| </form> |
| </body> |
| </html> |
Isn't it possible to place an empty RadMenu on a page? Or am I doing something wrong?
Thanks,
Eduardo
17 Answers, 1 is accepted
You are not doing something wrong ... I just ran into this today and can verify your results ... misery loves company so they say.
Regards,
Ryan Kirby
We have already fixed the problem and you can download the latest internal build to have it fixed.
Kind regards,
Veselin Vasilev
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.
Thanks
The next official release (Service Pack 2) is due at the end of this month - most probably on 27th of May.
Sincerely yours,
Albert
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 waited for the new release (27th May 2009) and still can't achieve the following.
Have a menu control on the page. The menu is build in Code Behind.
The following code only adds the Root Node, the ChildNode is not added and I get the following js error:]
Error: 'childNodes' is null or not an object.
What am I missing?
Dim Menu As New Telerik.Web.UI.RadMenu()
Dim RootNode As New Telerik.Web.UI.RadMenuItem("Root")
Menu.Items.Add(RootNode)
Dim ChildNode As New Telerik.Web.UI.RadMenuItem("Child")
RootNode.Items.Add(ChildNode)
Me.rmMenu = Menu
| Dim RootNode As New Telerik.Web.UI.RadMenuItem("Root") |
| Dim ChildNode As New Telerik.Web.UI.RadMenuItem("Child") |
| RootNode.Items.Add(ChildNode) |
| Me.rmMenu.Items.Add(RootNode) |
The issue may be elsewhere but it's difficult to test. My reason for posting it here is that the javascript error matched the one I'm getting.
We have a very dynamic menu structure which can only be built using custom attributes in an XMLDatasource and then on the databinding of the Menu Items. the XMLDatasource (XML String) is currently stored in session on each SessionStart Event. The menu's datasource is set to the XML string stored in session, everything works beautifully.
Now, to avoid running the Logic on each databound item every time the page is loaded I decided to store the ENTIRE MENU in Session.
The idea was to build the menu in the SessionStart event, then set the menu on the page to the menu in Session, using something like this.
Me.rmMenu = Session("MenuProducts")
However, no matter how I build the menu initially, it always seems to give the above mentioned error.
The strange thing is that Me.rmMenu.Items.Count is never 0
Have I been staring at this for too long and am I missing something really simple?
It was lack of sleep. Should be storing the RadMenu XML in session rather than the actual Menu Control or the XMLDatasource, then call Menu.LoadXML() and pass in the complete menuXML.which is static for the rest of the session.
Maybe it's not as generic as it could be but if you'll be using the Telerik controls for a while to come, I dont see a problem.
We want to store the XML of the RadMenu in Session and remove the styling logic from the ItemdataBound event handler.
To do this, we need to add the styles to the XML.
Cannot find any documentation on this???
The closest I got is this document http://www.telerik.com/help/aspnet-ajax/menu_itemsxml.html
It states;
"To discover the way to represent a specific RadMenu feature in XML, create a RadMenu with the feature and use the RadMenu.GetXml method to get the corresponding XML string."
I did exactly that.
created a new Menu
| <telerik:RadMenu |
| ID="rm1" |
| runat="server"> |
| <Items> |
| <telerik:RadMenuItem |
| runat="server" |
| Font-Bold="True" |
| Font-Italic="True" |
| Font-Overline="False" |
| Font-Underline="True" |
| ForeColor="#FFEE66" |
| NavigateUrl="http://test1.html" |
| Target="_blank" |
| Text="home"> |
| </telerik:RadMenuItem> |
| </Items> |
| </telerik:RadMenu> |
When getting the XML, I end up with this.
| <?xml version="1.0" encoding="utf-16"?> |
| <Menu> |
| <Group> |
| <Item Text="home" NavigateUrl="http://test1.html" Target="_blank" ForeColor="#FFEE66" /> |
| </Group> |
| </Menu> |
How do I get the Font styles into the RadMenu XML file?????
The Font and Color styles are currently not serialized to XML as they are inherited properties. You can use the CssClass property instead. Combine all those settings in a single CSS class. This would also decrease the total output of your page since the same css attribute settings will not be rendered for all items that use it.
Regards,
Albert
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.
Our Menu is already styled and looks great to the public. The nodes available to the public are populated and everything works fine.
However, when an administrator logs into the web site, they see some additional content which is not available to the public.
For example;
If you're a "content editor" you may see Menu nodes which are awaiting approval, these nodes may have a yellow background.
Or, if you're a member of a certain department, the Menu nodes text may be bold. Or a link to an external site may be underlined.
In the past, we were creating a XMLDataSource file with custom properties, then reading those properties in the Menu's ItemDataBound event and changing the styles on the fly, depending on the logged in users roles/permissions/etc...
To speed things up, we wanted to store the XMLDataSource in Session for each user and bind the Menu to that XMLDataSource. However, we still had to set the styles on ItemDataBound. We looked through the forum and a good suggestion was made by yourself just over a year ago http://www.telerik.com/community/forums/aspnet/menu/problem-loading-cached-radmenu.aspx which we followed.
And the end of all this, we now have an XML in Session that we can "fill" the menu with (Menu.LoadXML(...)) but we can only set the "ForeColor". Is there another way of achieving this without modifying each node on the ItemDataBound event?
p.s. The forum's "Reply" text area doesn't work on the iPhone.
You can use the CssClass instead of ForeColor and Font.
<style>
.someClass
{
font-weight: bold !important;
text-decoration: underline !important;
color: #FFEE66 !important;
}
</style>
<telerik:RadMenuItem CssClass = "someClass" .. />
Regards,
Albert
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.
Please excuse my ignorance, but where do we set this apart from the Bound Event?, we would like to store this in the session as per previous posts.
You can set the CssClass property whenever you want it. You can set it in your XML file if you are using LoadContentFile, define it inline or set it from code.
Regards,
Albert
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.
Thanks Albert
You're suggestion works as you described, however, the problem with this solution is that we need to specify a CssClass for each combination of possible scenarios and then apply the appropriate Class.
For example, if a user has 5 roles and each content has 5 possible status levels, then we may want a combination of Styles (Underline, background-color,bold,color,etc......) this is 5 Combinations of 5 CssStyles = 25 CssClasses, if we add 2 more, that's 49 CssClasses!
Although it is possible to build up the Classes Programatically, it would be much simpler to be able to apply the styles directly to the RadMenuItem.
Is there a better solution such as <telerik:RadMenuItem CssStyle = "font-weight: bold !important;text-decoration: underline !important" .. />
Unfortunately there is no other way. You could use the Style property however it is not persisted in XML at the moment either.
Regards,
Albert
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.