Repeter inside RadDock doesn't fire Item Command

3 posts, 0 answers
  1. Faten
    Faten avatar
    3 posts
    Member since:
    Dec 2011

    Posted 24 May 2012 Link to this post

    I'm using repeater inside a user control, which is dynamically generated by other parent page inside raddock, so the hierarchy is: Page, RadDock, User Control, Repeater.

    My problem is that the repeater doesn't fire Item command event,
    Here is the code of the repeater inside the user control:

    <asp:Repeater ID="rptrFirst5Assignments" runat="server"
        onitemcreated="rptrFirst5Assignments_ItemCreated" >
            <table >
                <tr >
                    <td >
                        <asp:Label ID="lblAssignmentID" runat="server" Text='<%# Bind("Asm_ID") %>'
                        <asp:Label ID="lblCreatedByID" runat="server" Text='<%# Bind("Asm_CreatedBy") %>'
                        <asp:Label ID="lblAssignment" runat="server" CssClass="alltext" Text='<%# Bind("Asm_Body") %>'></asp:Label>
                     <td style="float:left;">
                     <asp:LinkButton ID="btnDelete" runat="server" CausesValidation="false" CssClass="link-delete" CommandName="Delete"
                                    CommandArgument='<%# Eval("Asm_ID")%>' /></td>

    And this is how i dynamically create the rad docks in the parent page:
    as mentioned in the demo of rad dock:
    if (!Page.IsPostBack)
    for (int i = 0; i < RadDockLayout1.Controls.Count; i++)
                        if (RadDockLayout1.Controls[i].GetType() == typeof(RadDock))
                            RadDock radDock = (RadDock)RadDockLayout1.Controls[i];
                                List<Assignment> assignments = AssignmentBL.SearchTodayAssignments(3,5,0, SelectedDate);
                                radDock.Title =  assignments.Count ;         
    private void CreateDocksFirstTime()
                RadDock dock3 = CreateRadDock();
                //adding the dock to the docklayout and then docking it to the zone to avoid ViewState issues on subsequent postback
                dock3.Height = new Unit(300, UnitType.Pixel);
                //Load the selected widget in the RadDock control
                dock3.Tag = "Controls\\TeacherDateView\\TeacherDateViewAssignments.ascx";
    private void LoadWidget(RadDock dock)
                if (string.IsNullOrEmpty(dock.Tag))
                Control widget = LoadControl(dock.Tag);
                widget.EnableViewState = false;

    And then i re create them from the saved state at Page_Init as mentioned in the RadDock Demo
    protected void Page_Init(object sender, EventArgs e)
                //Recreate the docks in order to ensure their proper operation
                for (int i = 0; i < CurrentDockStates.Count; i++)
                    RadDock dock = CreateRadDockFromState(CurrentDockStates[i]);
                    //We want to save the dock state every time a dock is moved.
                    //Load the selected widget
                    if (CurrentDockStates[i].Closed == true)
                        dock.Visible = false;

    Note that i have buttons inside the user control and they work correctly, Also repeater_ItemDataBound and ItemCreated event handlers are firing correctly.

    Any suggestions??
  2. Slav
    Slav avatar
    1359 posts

    Posted 29 May 2012 Link to this post

    Hi Faten,

    Please check if the dynamically added RadDock controls are recreated correctly, if the value of their properties ID and UniqueName is always the same.

    You can check the proper setup in the online demo My Portal. To replicate your scenario I have created a user control, which is attached to this post, and I have included it in the user control selector in the demo:
    <asp:DropDownList runat="server" ID="DroptDownWidget" Width="150">
        <asp:ListItem Text="RepeaterControl.ascx" Value="~/Dock/Common/RepeaterControl.ascx"></asp:ListItem>
        <asp:ListItem Text="ExchangeRatesCS.ascx" Value="~/Dock/Common/ExchangeRatesCS.ascx"
        <asp:ListItem Text="TelerikNews.ascx" Value="~/Dock/Common/TelerikNews.ascx"></asp:ListItem>
        <asp:ListItem Text="TelerikBlogs.ascx" Value="~/Dock/Common/TelerikBlogs.ascx"></asp:ListItem>
        <asp:ListItem Text="HoroscopesCS.ascx" Value="~/Dock/Common/HoroscopesCS.ascx"></asp:ListItem>
        <asp:ListItem Text="WeatherCS.ascx" Value="~/Dock/Common/WeatherCS.ascx"></asp:ListItem>

    If you are still having difficulties after modifying the demo as described above, please provide a reliable steps for reproducing the problem, as the ItemCommand event is firing on my end.

    All the best,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. Faten
    Faten avatar
    3 posts
    Member since:
    Dec 2011

    Posted 29 May 2012 Link to this post

    Thanks a lot for your reply,  the rad docks are re created correctly with the same ID and unique name,but The problem is solved by rebinding the repeater data at every postback. (after recreation)

    Thanks a lot
Back to Top