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

Populating RibbonBar from XML with application menu

3 Answers 99 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
romulo~
Top achievements
Rank 1
romulo~ asked on 06 Nov 2012, 11:29 AM
I'm developing some prototype and i'd like to make use of ribbon bar just like an office application, for example, i want the ribbon bar to have that application menu with some options like, new, save, and stuff like that. I'm also using a panel bar as a side menu.

The scenario is:
I need to change the tabs and buttons of the ribbon bar with an event from the side bar.

The event on the sidebar changes the xml that populates the ribbon bar but that is where I have a problem.

To change the ribbon bar with xml I have to remove the application menu because with it, I get some exception.

Sys.WebForms.PageRequestManagerServerErrorException:
Failed to load viewstate.  The control tree into which viewstate is being
loaded must match the control tree that was used to save viewstate during
the previous request. For example, when adding controls dynamically, the
controls added during a post-back must match the type and position of the
controls added during the initial request.


I believe that it could be solved if I add definitions for application menu in the xml and use my population event.
But the xml that was created from the method from ribbonbar ("GetXml()") didn't create anything.

I'd like to know if I should add it manually or the tags to do so. (if possible)
Or even another way to make something like that (use the dynamic population for the ribbon bar with application menu)

Thanks

3 Answers, 1 is accepted

Sort by
0
Accepted
Bozhidar
Telerik team
answered on 07 Nov 2012, 09:49 AM
Hello,

The current implementation of RadRibbonBar does not include support for loading the ApplicationMenu from a Xml file. We will try our best to include it in our next official release.

In the meantime, you can use the following approach: load the RibbonBar from the xml file. After that manually add the ApplicationMenu. Please note that this should be done in the Page_Init event.

Here's an example of what that should look like:
protected void Page_Init(object sender, EventArgs e)
{
    RadRibbonBar1.LoadContentFile("RibbonBar.xml");
    RibbonBarApplicationMenu menu = new RibbonBarApplicationMenu();
    menu.Text = "App Menu";
    RibbonBarApplicationMenuItem item = new RibbonBarApplicationMenuItem();
    item.Text = "first item";
    RibbonBarApplicationMenuItem item2 = new RibbonBarApplicationMenuItem();
    item2.Text = "second item";
    menu.Items.Add(item);
    menu.Items.Add(item2);
    RadRibbonBar1.ApplicationMenu = menu;
}

 
Regards,
Bozhidar
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
romulo~
Top achievements
Rank 1
answered on 08 Nov 2012, 12:38 PM
Thanks Bozhidar,

Also i'd like to know another thing, is it possible to make use of templates to add submenu to the ApplicationMenu? Or is it for another update?
0
Bozhidar
Telerik team
answered on 09 Nov 2012, 08:07 AM
Hello,

The RibbonBar Application menu currently doesn't support submenu items or templates. 
 
Kind regards,
Bozhidar
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
RibbonBar
Asked by
romulo~
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
romulo~
Top achievements
Rank 1
Share this question
or