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

RadDock Deletion

5 Answers 185 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Vikas
Top achievements
Rank 1
Vikas asked on 25 Oct 2010, 11:23 PM
Is it possible to remove the RadDock from particular Zone from server side.
I have to dynamically load the raddocks oninit depending upon the profile of current User,
I have some link buttons on the page of different users, so I have to updated RadDocs depending upon the selection.
I tried but either it is not updating.

5 Answers, 1 is accepted

Sort by
0
Vikas
Top achievements
Rank 1
answered on 26 Oct 2010, 06:03 PM
I am getting following exception:

Please, ensure that the UniqueName property of RadDock with ID='RadDockDockUnqName3' is unique to RadDockLayout with ID='RadDockLayout1'.


For Deleting I have used following code



// Delete button code
if (RadDockZone1.Docks.Count > 0)
            {

                string unqName = "DockUnqName" + a;
                RadDock dock = (from s in RadDockZone1.Docks
                                where s.UniqueName == unqName
                                select s).First();
            
                dock.Closed = true;
                RadDockZone1.Docks.Remove(dock);                            

            }



I am adding the Page and Code file. If you can find anything please update me. I first thought it is updatePanel Script error so i commented it, but is coming whenever i Press Add button.
0
Pero
Telerik team
answered on 27 Oct 2010, 12:26 PM
Hello Vikas,

It is not recommended to remove the docks after they have been created earlier in the page life-cycle, because ViewState problems might arise. Instead you should make them invisible (i.e. Visible="false" and Closed="true"), and then create only the Closed="false" (Visible="true) docks in the Page.Init on the next trip to the server.

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
Vikas
Top achievements
Rank 1
answered on 27 Oct 2010, 02:56 PM

But i have the scenario that i have to reload all the Dock zones with Docks dynamically.
When the Page first get loaded I am doing all the Dock loading on page Init.
But as i said I am having drop down that contain users, so depending upon the user selected i have to reload the zones with Docks depending upon the personalization.

i tried something on Delete in one sample Application:

 

RadDockZone1.Docks.Remove(dock); 

 

 

RadDockLayout1.Controls.Remove(dock);

So it was working for me, Even if i Add new dock with same UniqueName then it was allowing me to do with no errors. But in another application i am not even getting the Dock control as a pert of RadDockLayout1.Controls collection. I am not able to understand why at one place Dock control object is part of RadDockLayout and in another it is not.

 

0
Vikas
Top achievements
Rank 1
answered on 27 Oct 2010, 04:39 PM
Continuing my previous post. As i said for another appliction DashboardLayout is not having RadDock as part of controls section, So i tried following lines and they are working for me now. I think the issue is resolved now.

RadDockZone1.Docks.Remove(dock); 
RadDockZone1.Controls.Remove(dock);

Can you please update me on this why applications are behaving differently?
0
Pero
Telerik team
answered on 01 Nov 2010, 02:24 PM
Hello Vikas,

I am glad you resolved the issue.

By design the RadDockLayout control requires all registered docks and zones to have different values for their UniqueName properties. I am not sure why you had problems in one of the applications when removing the docks, but in any way it is not related to the RadDockLayout control, because if two docks with identical UniqueName are registered at the same with the Docking Layout, an exception will be thrown.

To remove a dock from the Controls collection of a parent control, you should make sure you are removing it from its direct parent. I suppose, one time the dock is added to the controls collection of the Layout, and other time to the controls collection of the DockingZone. That's why removing it from the zone works in one of the scenarios.

For example in our MyPortal demo when the dock is created for the first time it is added to the zone, and when recreated in the Page.Init event handler it is added to the DockingLayout. If you try to remove it from the RadDockLayout's controls collection, when in fact it is added to the zone, the dock will not be removed.

To avoid similar issues in the future, please make sure you always add the dock to the RadDockLayout, control, and then set the RadDock's DockZoneID property to the ClientID of the zone, where you want to position your dock.

Kind regards,
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
Tags
Dock
Asked by
Vikas
Top achievements
Rank 1
Answers by
Vikas
Top achievements
Rank 1
Pero
Telerik team
Share this question
or