Docking In Datalists

3 posts, 0 answers
  1. Matt
    Matt avatar
    2 posts
    Member since:
    Sep 2010

    Posted 22 Sep 2010 Link to this post

    Hey guys and gals,

    First time posting here - but I'm thus far really liking all the products. In fact, I'll probably pick up the control pack if everything works out.

    In any case, I'm a bit of a noob with all this and was looking for a solution to my issue. This situation:

    I have a Stand-Alone Zone and a Datalist which has a Zone and Dock in each populated row. The end-all is that the user will populate the Stand-Alone with his/her selection from the Datalist.

    I loaded everything in, ran it, and got an error.

     """"The ID of RadDock with ID='RadDock1' is not unique to RadDockLayout with ID='RadDockLayout1'. Please, set the UniqueName property of RadDock with ID='RadDock1' with a value, which is unique to RadDockLayout with ID='RadDockLayout1'."""""

    So - I'm pretty sure I'm just not adding a spot of code somewhere or something. Anyhoo - is there anyone out there who could give me a hand with the solution?

    I greatly appreciate it!
    Thanks in advance.


  2. Pero
    Pero avatar
    1156 posts

    Posted 24 Sep 2010 Link to this post

    Hi Matt,

    The RadDockLayout controls expects every dock inside to have a different UniqueName. If the UniqueName is not specified (I assume you have not specified the UniqueName), the RadDockLayout will use the ID of the dock. In the DataList control, all the docks have one and the same ID, but belong to a different INamingContainers. So, that's why an exception will be thrown, because the DockLayout sees that all docks have the same id.
    To resolve the issue, you can dynamically assign the UniqueName of every dock in the DataList, to the dock's UniqueID. For your convenience, I have created a sample project, that uses this approach. Here is the full source code:

    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <head runat="server">
        <form id="form1" runat="server">
        <asp:ScriptManager ID="RadScriptManager1" runat="server">
        <asp:Button ID="Button1" runat="server" Text="Postback" />
            <telerik:RadDockLayout ID="RadDockLayout1" runat="server">
                <asp:DataList ID="ItemsList" BorderColor="black" CellPadding="5" CellSpacing="5"
                    RepeatDirection="Vertical" RepeatLayout="Table" RepeatColumns="3" runat="server">
                    <HeaderStyle BackColor="#aaaadd"></HeaderStyle>
                    <AlternatingItemStyle BackColor="Gainsboro"></AlternatingItemStyle>
                        List of items
                        <telerik:RadDockZone ID="RadDockZone1" runat="server" Width="300px">
                            <telerik:RadDock ID="RadDock1" runat="server" Title="Dock">
                                    Some Content
                <telerik:RadDockZone ID="RadDockZone1" runat="server" MinHeight="300px" Width="300px">
                    <telerik:RadDock ID="RadDock2" runat="server" Title="RadDock-Title" Width="300px">
                            <br />
                            <br />
                            <br />
                            <br />
                            <br />
                            <br />
                            <br />
                            <br />
                            <br />
                            <br />

    using System;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Data;
    using System.Configuration;
    using System.Web.Security;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using Telerik.Web.UI;
    using System.Collections;
    public partial class Default : System.Web.UI.Page
        protected void Page_Load(Object sender, EventArgs e)
            // Load sample data only once, when the page is first loaded.
            if (!IsPostBack)
                ItemsList.DataSource = new string[] { "1", "2", "3", "4", "5", "1", "2", "3", "4" };
                foreach (DataListItem item in ItemsList.Items)
                    RadDock dock = item.FindControl("RadDockZone1").Controls[0] as RadDock;
                    dock.UniqueName = dock.UniqueID;

    Best wishes,
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Matt
    Matt avatar
    2 posts
    Member since:
    Sep 2010

    Posted 13 Oct 2010 Link to this post

    This worked GREAT! Thanks for the feedback!
Back to Top