Help implementing splitter panels from database table entries

3 posts, 0 answers
  1. Paul
    Paul avatar
    4 posts
    Member since:
    Feb 2009

    Posted 17 Nov 2009 Link to this post

    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. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 17 Nov 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Paul
    Paul avatar
    4 posts
    Member since:
    Feb 2009

    Posted 25 Nov 2009 Link to this post

    Svetlina,

    You understood correctly.  That worked fine.

    Thanks

    Paul
Back to Top