This is a migrated thread and some comments may be shown as answers.
programmatically change RadDock zoneID
6 Answers 78 Views
This is a migrated thread and some comments may be shown as answers.
Adriano
Top achievements
Rank 1
Adriano asked on 27 Aug 2007, 10:55 PM
Hi,

I am wondering how cold I programmatically change RadDock zoneID. For example, In the code-behind I would move one Dock to a different Zone, in fact what I want do is change the RadDock Zone when this Dock is Closed.

I noticed that the zoneID and Index have only getters... they don't setters...

Any suggestion on how to do this?

Thanks,

Adriano

6 Answers, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 28 Aug 2007, 07:23 AM
Hello Adriano,

To move the dock to a different zone in code-behind you should use the Dock(zone) method of RadDock. I am attaching a simple page demonstrating how to move the dock to a different zone upon clicking the Close command. Let me know if you need further assistance with this.

Regards,
Petya
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Adriano
Top achievements
Rank 1
answered on 28 Aug 2007, 04:50 PM
Hi Petya,
That worked just fine.

Thank you very much,

Adriano
0
HL
Top achievements
Rank 1
answered on 13 Sep 2011, 10:31 PM
Hi Petya:
     When we close the dock, can we change dock index also? My situation is that I have two RadDockZones(Zone 1 and Zone2). Users can close the existing docks. User can also add these closed docks back to the RadDockZone2 after users select the Dock name. After these closed Dock re add in to radZone2, these new added dock should display at the bottom of the exsiting Docks on Zone 2

what I tried to do is:
1. change Dock.DockZoneID and also changed state.index ( Dock.index change also). please see code below

what issue now:
if the index of the existing Docks  inside RadDockZone2  is less than the  RadDockZone3.Docks.Count, it works. if the exisitng
dock index is larger than the RadDockZone2.Docks.Count, then the new added Rock will display on the top of the existing dock.
example: on RadDockZone2, it  has 6 docks before so the index will be 0,1,2,3,4,5
after I closed alll the Docks inside the RadDockZone2 except that index is 5. I readded the dock which index is 2.
after I readded and then I reset the index to RadDockZone2 .dock.count  // 1 dock now
then the readded dock will be on the top of the existing dock which index is 5

any suggestion ?
If state.Closed Or dock.Closed Then
                              state.DockZoneID = "ctlwucWidgets_RadDockZone2"
                              dock.DockZoneID =   state.DockZoneID 
                              state.Index = RadDockZone2.Docks.Count
                          End If


Thanks
Helena

0
Slav
Telerik team
answered on 15 Sep 2011, 11:25 AM
Hi Helena,

If I understand your scenario correctly, you want to add the RadDock controls dynamically to the bottom of the RadDockZone, contrary to the default behavior. This can be achieved via client script, registered from the server, which moves the new RadDocks to the last position of the dock zone. Below you can find a code sample, containing the script for incorporating the desired functionality:
RadScriptManager.RegisterStartupScript(this, this.GetType(), "MoveDock",
string.Format(@"function _moveDock() {{
    Sys.Application.remove_load(_moveDock);
    $find('{1}').dock($find('{0}'),{2});
    }};
    Sys.Application.add_load(_moveDock);", dock.ClientID, RadDockZone1.ClientID, RadDockZone1.Docks.Count), true);

Note that the client method dock is called in order to place the RadDocks in the correct position in the RadDockZone (in the example - RadDockZone1).

You can find attached a sample project, implementing the suggested approach. Please use it as a reference for you further development.

Greetings,
Slav
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal
0
HL
Top achievements
Rank 1
answered on 26 Sep 2011, 05:17 PM
Hi Slav:
  Thanks for your information. actually my situation is not to add the new dock at the bottom. Basically I have docks on the dockzone. I close the dock. now the dock changed the closed status to true. then users can select the lists for all the possible docks to add back to the zone. this time, dock already exist and I only need to change close status to false instead adding new dock. so on this situation, how I can make sure the dock's position will the the fix position ( rightest dockzone -- bottom the psotion)

Thanks
Helena
0
Slav
Telerik team
answered on 28 Sep 2011, 09:28 AM
Hi Helena,

You can still use the client script, suggested in my previous post, in order to dock the RadDock control at the last position in the RadDockZone. The only difference is that you should register the script in the server-side event, used to change the close status of the restored docks.

For your convenience I have attached a sample project, demonstrating the suggested approach. You can use it as a reference to incorporate the requested functionality into your actual project.

Kind 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
Dock
Asked by
Adriano
Top achievements
Rank 1
Answers by
Petya
Telerik team
Adriano
Top achievements
Rank 1
HL
Top achievements
Rank 1
Slav
Telerik team
Share this question
or