New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
Creating Splitter Programmatically
You can define the structure of RadSplitter dynamically in server-side code. To do this, you need to create RadPane and RadSplitBar objects and add them to the Items collection of their parent RadSplitter.
The Items collection does not persist in the ViewState if you create the splitter controls in the code-behind. You need to recreate them on every postback!
Example
The example below demonstrates how to create new RadSplitter object, populate its Items collection and add it to the page form. It also shows how to add a dynamically created label in the Controls collection of a RadPane control:
C#
protected void Page_Load(object sender, EventArgs e)
{
RadSplitter splitter = new RadSplitter();
splitter.ID = "RadSplitter1";
splitter.Width = new Unit("300px");
splitter.Height = new Unit("400px");
splitter.Orientation = Telerik.Web.UI.Orientation.Horizontal;
RadPane topPane = new RadPane();
topPane.ID = "TopPane";
Label topLabel = new Label();
topLabel.ID = "TopLabel";
topLabel.Text = "Top pane";
topPane.Controls.Add(topLabel);
splitter.Items.Add(topPane);
RadSplitBar splitBar1 = new RadSplitBar();
splitBar1.ID = "SplitBar1";
splitter.Items.Add(splitBar1);
RadPane middlePane = new RadPane();
middlePane.ID = "MiddlePane";
middlePane.Controls.Add(new LiteralControl("Middle pane"));
splitter.Items.Add(middlePane);
RadSplitBar splitBar2 = new RadSplitBar();
splitBar2.ID = "SplitBar2";
splitter.Items.Add(splitBar2);
RadPane bottomPane = new RadPane();
bottomPane.ID = "BottomPane";
bottomPane.Controls.Add(new LiteralControl("Bottom pane"));
splitter.Items.Add(bottomPane);
form1.Controls.Add(splitter);
}