Populating RibbonBar from XML with application menu

4 posts, 1 answers
  1. romulo~
    romulo~ avatar
    23 posts
    Member since:
    Nov 2012

    Posted 06 Nov 2012 Link to this post

    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
  2. Answer
    Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 07 Nov 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. romulo~
    romulo~ avatar
    23 posts
    Member since:
    Nov 2012

    Posted 08 Nov 2012 Link to this post

    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?
  5. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 09 Nov 2012 Link to this post

    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.
Back to Top