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

Remove dynamically created splitbar on collapse

1 Answer 26 Views
Splitter
This is a migrated thread and some comments may be shown as answers.
Sean
Top achievements
Rank 2
Sean asked on 07 Mar 2011, 01:22 AM
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;
splitter.Items.Remove(splitBarToRemove);
RadControlStates.SplitbarStates.Remove(splitBarToRemove.ID);

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?

1 Answer, 1 is accepted

Sort by
0
Sean
Top achievements
Rank 2
answered on 10 Mar 2011, 12:21 AM
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.
Tags
Splitter
Asked by
Sean
Top achievements
Rank 2
Answers by
Sean
Top achievements
Rank 2
Share this question
or