This is a migrated thread and some comments may be shown as answers.

Load Context Menu from File

10 Answers 341 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Kevin Wolf
Top achievements
Rank 1
Kevin Wolf asked on 19 Jan 2008, 04:44 PM
Hello - I have upgraded my project to use "Prometheus" from the ASP.NET version.  I have a number of context menus in XML Files.  Can they be used with the Prometheus tree view control?

Thanks in advance

Kevin
Tampa FL

10 Answers, 1 is accepted

Sort by
0
Erjan Gavalji
Telerik team
answered on 22 Jan 2008, 03:59 PM
Hi Kevin,

The format of the RadTreeViewContextMenu Xml files to be used with RadTreeView is changed a bit. All you need is separate a single "RadTreeViewContextMenu Classic" content file to different XML files - a file per context menu. The root tag of a context menu content file should then be the <Menu> tag. Further on, the context menu content file should be loaded by using the LoadContentFile method. I am attaching an example page to this ticket.

Unfortunately, lately we discovered that we have a slight omission with the RadTreeViewContextMenu content file loading, where the <Menu> tag is not recognized. The bug is fixed now and I am attaching the internal build hereby.

I hope this helps.

Kind regards,
Erjan Gavalji
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Kevin Wolf
Top achievements
Rank 1
answered on 27 Jan 2008, 07:05 PM
Thank you for the response Erjan - I understand what I need to do, but I think the defect you referred to as not picking up the <Menu> tag might still be in the Bin3.5 version of the 2007.03.1314.35.

When I attempt to load a menu file that matches the format you sent along with your email I get the exception <Menu xmlns=''> was not expected, also just as an FYI, I saw the LoadContentFile and it never occurred to me that it would load the context menu.  I looked a bit in the help and it wasn't obvious either... 

Attached is my Menu File:


  <Menu Name="root" Width="150">  
    <Item Image="/images/icons/Add.gif" Text="Add New Folder" PostBack="True" ID="addNewFolder" /> 
    <Item Image="/images/icons/Add.gif" Text="New Report" PostBack="True" ID="addNewReport" /> 
    <Item Image="/images/icons/Add.gif" Text="New Chart" PostBack="True" ID="addNewChart" /> 
    <Item Image="/images/icons/Add.gif" Text="Add Existing Report" PostBack="True" ID="addExistingReport" /> 
    <Item Image="/images/icons/Add.gif" Text="Add Existing Chart" PostBack="True" ID="addExistingChart" /> 
    <Item Image="/images/icons/Properties.gif" Text="Rename" PostBack="True" ID="rename"/>  
  </Menu> 
 
0
Erjan Gavalji
Telerik team
answered on 28 Jan 2008, 05:16 PM
Hi Kevin,

I'm truly sorry, it seems that parallel builds have been running and I sent you the earlier one.

Please, find attached the correct package. I just tested it with your content file and it was working fine.

Kind regards,
Erjan Gavalji
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Kevin Wolf
Top achievements
Rank 1
answered on 28 Jan 2008, 06:14 PM
Hmmm...I have file version 2007.3.1323.35 of Telerik.Web.UI.dll in the bin directory of my site.  I extracted this from the Bin35 direction with the hot-fix file I downloaed from your site...any thoughts on what I could be missing?

Also it says this is a "Trial Version" and I'm seeing that message once in a while through the front-end, I am a valid license holder.


Server Error in '/' Application.  
--------------------------------------------------------------------------------  
 
<Menu xmlns=''> was not expected.   
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.   
 
Exception Details: System.InvalidOperationException: <Menu xmlns=''> was not expected.  
 
Source Error:   
 
 
Line 47:         protected override void PopulateTree(RadTreeView tree)  
Line 48:         {  
Line 49:             tree.LoadContentFile(string.Format("~/App_Data/ReportTree/{0}/ReportTree_Folder.xml", ChaosFilter.Common.CurrentLanguage));  
Line 50:             tree.LoadContentFile(string.Format("~/App_Data/ReportTree/{0}/ReportTree_Report.xml", ChaosFilter.Common.CurrentLanguage));  
Line 51:             tree.LoadContentFile(string.Format("~/App_Data/ReportTree/{0}/ReportTree_Tree.xml", ChaosFilter.Common.CurrentLanguage));  
   
 
Source File: D:\ChaosFilter\Branches\Dev\ChaosFilter.Controls.Standard\Trees\ReportTree.cs    Line: 49   
 
Stack Trace:   
 
 
[InvalidOperationException: <Menu xmlns=''> was not expected.]  
   Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderRadTreeView.Read1_Tree() +137  
 
[InvalidOperationException: There is an error in XML document (1, 4).]  
   System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) +637  
   System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle) +32  
   System.Xml.Serialization.XmlSerializer.Deserialize(TextReader textReader) +163  
   Telerik.Web.UI.ControlItemContainer.LoadXml(String xml) +67  
 
   
 
0
Erjan Gavalji
Telerik team
answered on 29 Jan 2008, 07:52 AM
Hi Kevin,

The official hotfix (RadControls "Prometheus" Q3 2007 SP1) does not contain the fix I mentioned (I'm sorry for the same versioning, but this is just an internal build, that's why we haven't updated the version). The fix is included in the latest package I sent you yesterday. Its creation time was Jan 24th 2008, 12:28 GMT. Would you check if this is the file that resides in your website's bin folder?

Kind regards,
Erjan Gavalji
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Erjan Gavalji
Telerik team
answered on 29 Jan 2008, 07:53 AM
Hi Kevin,

Just a quick update regarding the trial message - as this is a public forum we cannot attach a dev version of the package here. Would you please, open a formal support ticket, so that I can send you the dev package?

Best,
Erjan Gavalji
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Accepted
Erjan Gavalji
Telerik team
answered on 31 Jan 2008, 02:39 PM
Hi guys,

Thanks to Kevin I found I missed mentioning some more differences in the XML content file formats in RadMenu "Classic" and RadMenu "Prometheus".

These are the following:
  • ID properties - for the uniqueness reasons, the ID property of a RadMenu is not read from the content file; the ID property of a RadMenuItem is not read to reduce the HTML output. The Value property should be used instead.
  • Group tag - all sibling items should be nested in a Group tag - it is needed to describe the group settings of the RadMenuItem group. If missing from the XML content file, the first item is ignored.
A valid format of a RadMenu XML content file can be found in the XML Definition online example.

Cheers,
Erjan Gavalji
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Phil C
Top achievements
Rank 2
answered on 19 Jun 2008, 04:33 PM
Hi, has this been sorted in Q1 2008?

It doesn't have anything in the documentation about loading the XML files, which would be handy. From this thread it looks like you have to use RadMenu, is that really necessary, seems odd to drop it from TreeView?

So, what is the best way to load the Context Menus from XML (and what is the final format)?

Sorry to tag an old thread, seems appropriate to round it off. Phil.
0
Erjan Gavalji
Telerik team
answered on 23 Jun 2008, 01:44 PM
Hi Phil,

The ContextMenus property in RadTreeView for ASP.NET AJAX is a collection of RadTreeViewContextMenu objects. The RadTreeViewContextMenu control inherits the RadContextMenu, which in turn inherits RadMenu.

The easiest way to populate a RadTreeViewContextMenu from an XML document is using the following syntax:

C#:
RadTreeView1.ContextMenus.Add(new RadTreeViewContextMenu());
RadTreeView1.ContextMenus[0].LoadContentFile("~/MyContextMenuContentFile.xml");

VB:
RadTreeView1.ContextMenus.Add(new RadTreeViewContextMenu())
RadTreeView1.ContextMenus(0).LoadContentFile("~/MyContextMenuContentFile.xml")

The structure of the context menu content file is the same as the structure of the RadMenu content file.

Please, excuse us for not mentioning this to the RadTreeView documentation. We are already working on fixing this.

Let me know if you have other questions.

Kind regards,
Erjan Gavalji
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Phil C
Top achievements
Rank 2
answered on 23 Jun 2008, 02:07 PM
Thanks for the clarification Erjan, the documentation pointer and the XML loading code. I've now populated the menus dynamically from code and after working with it realise how the RadMenu has been integrated into RadTree. This is a good thing really, so thanks again for the pointer! Cheers, Phil.
Tags
TreeView
Asked by
Kevin Wolf
Top achievements
Rank 1
Answers by
Erjan Gavalji
Telerik team
Kevin Wolf
Top achievements
Rank 1
Phil C
Top achievements
Rank 2
Share this question
or