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

Dyanmic RadDock with user control loaded while dock expands

2 Answers 123 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Karthik
Top achievements
Rank 1
Karthik asked on 06 Oct 2010, 05:01 PM
Hi all,

I am trying to add RadDock to my page dynamically. Inside the dock I have a RadAjaxPanel. While expanding the dock using the dock expand collapse button I am loading the user control inside the RadAjaxPanel. If I perform any postback inside the usercontrol the control disappears

If suppose if I have a RadGrid as a usercontrol with reordering columns on client property set true It doesnot work when the control is loaded inside the RadDock.

What should I do to solves these problems ?

Thanks in Advance

2 Answers, 1 is accepted

Sort by
0
Pero
Telerik team
answered on 11 Oct 2010, 03:53 PM
Hello Karthik,

I believe the problem with the disappearing of the user control is caused by the fact that, the user control is created on DockCommand, but it is not recreated on subsequent postbacks. Please note that the dynamically added controls, should be recreated on every postback, and it is the developer's responsibility to make sure the controls added dynamically are recreated on postbacks. So, please make sure you add the UserControl to the dock on every trip to the server. Notice that in our MyPortal example the LoadWidget that adds user control to the dock is called on every postback.

I created a sample project to test the second problem, but did not experience any problems. The full source code is pasted below. Could you please test it on your side, modify it so the problem can be reproduced and send it back?

aspx
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="RadScriptManager1" runat="server">
    </asp:ScriptManager>
    <script type="text/javascript">
        //Put your JavaScript code here.
    </script>
    <div>
        <telerik:RadDockLayout ID="RadDockLayout1" runat="server">
            <telerik:RadDockZone ID="RadDockZone1" runat="server" MinHeight="300px" Width="300px">
                <telerik:RadDock ID="RadDock1" runat="server" Title="RadDock-Title" Width="300px">
                    <ContentTemplate>
                        <telerik:RadGrid runat="server" ID="grdPendingOrders" AllowPaging="True" Width="100px"
                            AllowMultiRowSelection="true" PageSize="30" EnableHeaderContextMenu="true">
                            <MasterTableView TableLayout="Fixed">
                                <Columns>
                                    <telerik:GridDragDropColumn HeaderStyle-Width="18px" Visible="false" />
                                </Columns>
                            </MasterTableView>
                            <ClientSettings AllowRowsDragDrop="True" AllowColumnsReorder="true" ReorderColumnsOnClient="true">
                                <Resizing AllowColumnResize="true" />
                                <Selecting AllowRowSelect="True" EnableDragToSelectRows="false" />
                                <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                            </ClientSettings>
                            <PagerStyle Mode="NumericPages" PageButtonCount="4" />
                        </telerik:RadGrid>
                    </ContentTemplate>
                </telerik:RadDock>
            </telerik:RadDockZone>
        </telerik:RadDockLayout>
    </div>
    </form>
</body>
</html>

.cs
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;
 
public partial class Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        DataTable dt = new DataTable();
        dt.Columns.Add(new DataColumn("Name"));
        dt.Columns.Add(new DataColumn("Id"));
 
        dt.Rows.Add("Peter", "1");
        dt.Rows.Add("John", "2");
        dt.Rows.Add("Ben", "3");
        dt.AcceptChanges();
 
 
        grdPendingOrders.DataSource = dt;
        grdPendingOrders.DataBind();
    }
}


Sincerely yours,
Pero
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
0
Karthik
Top achievements
Rank 1
answered on 11 Oct 2010, 05:57 PM
Hi Pero,

Thanks for your suggestions. I have found the solution. The problem was due to the ajax manager settings which I specified programmatically. After removing that now it works fine.
Tags
Dock
Asked by
Karthik
Top achievements
Rank 1
Answers by
Pero
Telerik team
Karthik
Top achievements
Rank 1
Share this question
or