RadPanelItem with RadListBox dynamic binding?

Thread is closed for posting
2 posts, 1 answers
  1. Brian Mains
    Brian Mains avatar
    485 posts
    Member since:
    Oct 2008

    Posted 30 Oct 2009 Link to this post

    Hello,

    I tried to adopt what was done in your MVC forum sample project for the RadPanelBar.  What I want to do is add a series of RadPanelItem's that contain a RadListBox control as its interface.  The RadListBox will be data bound.  But I'm getting an error about adding controls after prerender.  Is there something I can do to remedy that, or do the RadPanelItem/RadListBox have to be hard coded in?

    My approach was:

    <%
    if (Model.Groups != null)
    {
        foreach (var group in Model.Groups)
        {
            RadListBox box = new RadListBox();
            box.DataSource = group.Items;
            box.DataTextField = "Name";
            box.DataValueField = "Key";

            box.DataBind();

            RadPanelItem item = new RadPanelItem(group.Name);
            item.Controls.Add(box);

            rpbContacts.Items.Add(item);
        }
    }
    %>

    <tel:RadPanelBar ID="rpbContacts" runat="server" />

    Thanks.
  2. Answer
    Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 04 Nov 2009 Link to this post

    Hello Brian,

    To achieve your goal you will need to render the controls with HtmlHelper. Here is attached a simple test project which shows how to use RadHtmlHelper.

    Greetings,
    Georgi Krustev
    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
Back to Top