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

Dynamically added Raddocks Optimization!!

1 Answer 78 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ankush
Top achievements
Rank 1
Ankush asked on 30 Nov 2011, 01:36 PM
Hello,

We have a optimization problem regarding rad dock controls. The requirement of project is such that we are creating dynamic raddocks on the fly and adding it to a raddockzone, then we are saving the raddock "type" etc in a mssql db. We also have a collector window/raddockzone in which we have build a functionality where we can drag a dock and save it in collector. As with the first raddockzone we are adding the dock in collector on the fly. Now while adding a dock or moving it to another raddockzones it takes sometime. Our client is comparing it with the example of the demo link : http://demos.telerik.com/aspnet-ajax/dock/examples/content/defaultcs.aspx 

Following is our code snippet to add dock on the fly:

    private RadDockNew CreateRadDock()
    {


        //string[] allowedZones = { "RDZCollector", "RadDockZone2" };
        int width = Convert.ToInt32((hdnWidth.Value == "") ? "520" : hdnWidth.Value);
        RadDockNew dock = new RadDockNew();
        dock.DockMode = DockMode.Docked;
        dock.UniqueName = Guid.NewGuid().ToString().Replace("-", "a");
        dock.ID = string.Format("RadDock{0}", dock.UniqueName);
        //dock.Title = dock.UniqueName.Substring(dock.UniqueName.Length - 3);
        dock.Width = Unit.Pixel(width);
        dock.CssClass = "RadDockZoneMain";
        //dock.AllowedZones = allowedZones;
        dock.Style.Add("min-height", "290px");
        dock.OnClientDockPositionChanged = "DropInCollector";
        //dock.EnableViewState = false;
        DockCommand cmd = new DockCommand();
        cmd.Name = "Setting";
        cmd.Text = "Setting";
        cmd.OnClientCommand = "showSettings";
        dock.Commands.Add(cmd);
        DockCommand dc = new DockCommand();
        dc.Text = "Trash";
        dc.Name = "Trash";
        dc.OnClientCommand = "CloseDock";
        dc.CssClass = "rdClose";
        dc.AutoPostBack = true;
        dock.Commands.Add(dc);
        DockToggleCommand cmd2 = new DockToggleCommand();
        cmd2.CssClass = "rdCollapse";
        cmd2.AlternateCssClass = "rdexpand";
        cmd2.OnClientCommand = "ChangeImage";


        //DockCommand collapse = new DockCommand();
        //collapse.Text = "Collapse/Expand";
        //collapse.Name = "Collapse/Expand";
        //collapse.OnClientCommand = "CollapseDock";
        //collapse.CssClass = "rdCollapse";
        dock.Commands.Add(cmd2);
        return dock;
    }

Please tell if there is any way to optimize / make it faster.

Thanks.
  

1 Answer, 1 is accepted

Sort by
0
Slav
Telerik team
answered on 05 Dec 2011, 09:34 AM
Hi Ankush,

The code snippet that you have provided seems to be correct. It is possible that your connection with the database is causing the problems. You can try saving the RadDock state in a session or a cookie in order to check whether the problem persists. Also, please verify if there are any JavaScript errors on the page, containing the dock controls.

I have attached a sample project, based on the online demo My Portal, which implements saving the current state of  the RadDocks on the page in a database. My suggestion is to check it and to use it as a reference for achieving the desired effect without any slowdowns.

Note that at the current circumstances I am mostly unaware of your actual project's setup. If you are still experiencing issues, after reviewing the provided information, please try modifying the attached sample in order to recreate the problem and send it  so that we can inspect it locally and suggest a proper solution. In case the suggested approach is not possible you could also send a simple, runnable page that isolates the problem or a live URL to your page.

Regards,
Slav
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
Tags
General Discussions
Asked by
Ankush
Top achievements
Rank 1
Answers by
Slav
Telerik team
Share this question
or