Remove dynamically created splitbar on collapse

2 posts, 0 answers
  1. Sean
    Sean avatar
    200 posts
    Member since:
    Nov 2010

    Posted 06 Mar 2011 Link to this post

    Hi Telerik,

    I have reviewed the example on how to remove a dynamically created splitbar here. I am trying to remove a RadPane and RadSplitBar from a RadSplitter on collapse.

    First, during the OnClientCollapsed event I make an ajaxRequest to force a postback on the page. Then, during SaveDockLayout I perform validation on my controls and remove those controls which need to be removed. 

    RadSplitter splitter = splitBarToRemove.Splitter;

    I do this inside of SaveDockLayout -- which causes an exception to be thrown later on. Presumably, this exception is being caused by the fact that I am modifying the view state (?) during a period in which it should not be modified.

    By using the line "splitter.Items.Remove(splitBarToRemove)" I get the message
    else{var g=this.getSplitBarByIndex(0);
    var e=g.get_element();
    Uncaught TypeError: Cannot call method 'get_element' of null
    off over in a Telerik.Web.UI.WebResource -- the one for the RadSplitter, presumably. Anyway, I remove the code that brings the dynamically created SplitBar back -- so I'm not adding a new SplitBar to the RadSplitter. I've tried just disabling the control. The code doesn't know that the RadSplitBar should be removed until after the ajaxRequest has finished processing as SaveDockLayout needs to fire and an AjaxRequest is necessary to make the postback happen. Any thoughts?
  2. Sean
    Sean avatar
    200 posts
    Member since:
    Nov 2010

    Posted 09 Mar 2011 Link to this post

    I fixed this. Instead of performing things during SaveDockLayout I pass arguments to the ajax request -- a delete command and the pane to delete and do the work inside of the ajax command. Seems to work.
Back to Top