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

Help implementing splitter panels from database table entries

2 Answers 48 Views
Splitter
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 17 Nov 2009, 10:12 AM
I'm sure that this will sound like a ridiculous question to experienced c# programmers, but here goes.  I would like to be able to dynamically create splitter panels from database table entries, but cannot name the new instance of the RadSlidingPlane class as the correct type.  The logic of what I want to do is below. 

 

 

_conn.Open();

 

SqlCommand command = new SqlCommand("SELECT ID,TabTitle,Description FROM WidgetTypes", _conn);

 

 

SqlDataReader widgettypelist = command.ExecuteReader();

 

 

if (widgettypelist.HasRows)

 

{

widgettypelist.Read();

 

 

RadSlidingPane "SlidingPane" + widgettypelist["ID"].ToString() = new RadSlidingPane();

 

SlidingPaneX.Scrolling =

SplitterPaneScrolling.None;

 

SlidingPaneX.Title = widgettypelist[

"TabTitle"];

 

Radslidingzone1.Controls.Add(SlidingPaneX);

 

WidgetGalleryControl1.WidgetType = widgettypelist[

"ID"];

 

}

_conn.Close();

All help greatfully received.

2 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 17 Nov 2009, 03:41 PM
Hi Paul,

I am not comletely sure that I understood the problem you report - as far as I understood from your explanations you experience problems with naming dynamically created objects. If so, please, note that this is not directly related to RadSlidingPane or RadControls but to general manner of naming objects.

What I can suggest is that you give some name to the variable which is teh new pane and set the desired string you evaluate from the database as its ID as shown below:

RadSlidingPane  myPane = new RadSlidingPane();  
myPane.ID = "SlidingPane" + widgettypelist["ID"].ToString();
myPane.Scrolling = SplitterPaneScrolling.None; 

In this manner you can reference the pane in the code - behind by using the variable name (myPane) and at the same time it will have the correct ID which you can use to reference the pane on the client.

I hope that my explanation and suggestion are helpul, in case I have misunderstood you, please provide more detailed explanations of teh exact problem and the exact goal you want to achieve.

All the best,
Svetlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Paul
Top achievements
Rank 1
answered on 25 Nov 2009, 10:59 AM
Svetlina,

You understood correctly.  That worked fine.

Thanks

Paul
Tags
Splitter
Asked by
Paul
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Paul
Top achievements
Rank 1
Share this question
or