Dynamically added Ribbon button throwing Sys.WebForms.PageRequestManagerServerErrorException

6 posts, 0 answers
  1. Mohan
    Mohan avatar
    1 posts
    Member since:
    Jul 2011

    Posted 13 Jul 2011 Link to this post


    I am adding a new Ribbon tab with two ribbon buttons dynamically. When i click the added ribbon button, its throwing the error,
    Error: Sys.WebForms.PageRequestManagerServerErrorException: Index was out of range. Must be non-negative and less than the size of the collection.

    What may be the Issue?



  2. Simon
    Simon avatar
    2281 posts

    Posted 18 Jul 2011 Link to this post

    Hello Mohan,

    RibbonBar items are not stored in ViewState, so you have to add them on each page load in the Init phase (Page.OnInit).

    I hope this helps.

    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  3. DevCraft R3 2016 release webinar banner
  4. Hunter
    Hunter avatar
    44 posts
    Member since:
    Aug 2012

    Posted 27 Dec 2011 Link to this post

    Hello guys,

    I too ran into this same problem and have since moved my ribbon (re)creation to page_Init event (vb.net). Everything works as expected with one exception. My design implements dynamically loaded user controls which tell the containing page which ribbon configuration to use (ribbon is located in aspx page). In my initial testing I loaded the ribbon in the page_load event. In that event I was late enough in the page's life cycle to read a radTreeview's selected node value to retreive the settings required by the currently loaded user control. Now that I am forced to use the page_init event I obviously don't have access to the treeview. Could anyone suggest a way to store a value which can be read during page_init?
  5. Bozhidar
    Bozhidar avatar
    1096 posts

    Posted 28 Dec 2011 Link to this post

    Hello Hunter,

    To read a value in the Page_Init event, you can use a hidden field and the Request object. Please refer to this forum post for more information on the topic.

    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
  6. Hunter
    Hunter avatar
    44 posts
    Member since:
    Aug 2012

    Posted 28 Dec 2011 Link to this post

    That did it! Thanks for the help!
  7. Garry
    Garry avatar
    43 posts
    Member since:
    Sep 2012

    Posted 28 Mar 2012 Link to this post

    Great tip about using Page_Init() event - solved my problem with dynamic and contextual ribbon tabs.
Back to Top
DevCraft R3 2016 release webinar banner