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

Close Command

5 Answers 66 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Andy Ho
Top achievements
Rank 1
Andy Ho asked on 04 Aug 2010, 05:26 AM
Hi,

I tried to create a docks dynamically with the following code:

                Dim newdock As RadDock = CreateRadDock()
                newdock.Tag = "../Webparts/Info.ascx"
                newdock.DockMode = DockMode.Docked
                newdock.EnableRoundedCorners = True
                newdock.UniqueName = "BXT"
                newdock.ID = "BXT"
                newdock.Skin = "Telerik"

                newdock.DefaultCommands = Telerik.Web.UI.Dock.DefaultCommands.Close

                Dim cmd As New DockCommand
                cmd.Name = "DoSomething"
                cmd.Text = "DoSomething"
                newdock.Commands.Add(cmd)

                newdock.CommandsAutoPostBack = True
                newdock.Title = "Testing":

                newdock.Height = New Unit(200, UnitType.Pixel)
                AddHandler newdock.Command, AddressOf RadDock_Command
                LoadWidget(newdock)
                zoneLeft.Controls.Add(newdock)

The dock created sucessfully but when I clicked the default "Close" command, the server event "RadDock_Command" doesn't fire, But if I click the "Custom" command, it works ok. I want to capture the close event as I want to do something else. Please advise.

Andy Ho

               

5 Answers, 1 is accepted

Sort by
0
Accepted
Pero
Telerik team
answered on 06 Aug 2010, 03:52 PM
Hi Andy,

Could you please make sure the Close command is also added to the Commands list of the RadDock, as shown below:

Dim dock As New RadDock()
dock.DockMode = DockMode.Docked
dock.UniqueName = Guid.NewGuid().ToString().Replace("-", "a")
dock.ID = String.Format("RadDock{0}", dock.UniqueName)
dock.Title = "Dock"
dock.Text = String.Format("Added at {0}", DateTime.Now)
dock.Width = Unit.Pixel(300)
 
dock.Commands.Add(New DockCloseCommand())
dock.Commands.Add(New DockExpandCollapseCommand())



All the best,
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
Andy Ho
Top achievements
Rank 1
answered on 07 Aug 2010, 01:41 PM
Pero,

Thanks.

One more quick question for you, I COPIED my web-application from the Development server to another new server, the program works ok but all the skin disappear, the RadMenu becomes <li> tag, is there anything else I need to copy/install also?

Thanks in advance.

Andy


0
Andy Ho
Top achievements
Rank 1
answered on 07 Aug 2010, 01:54 PM
Forget to tell, I'm using the "Outlook" skin.
0
Andy Ho
Top achievements
Rank 1
answered on 09 Aug 2010, 03:01 AM
Pero,

Yes, After I add the command with:

dock.commands.add(new DockCloseCommand)

it works ok, just wonder why if I use: 

dock.DefaultCommands = Telerik.Web.UI.Dock.DefaultCommands.Close

it shows the command but not add the event handle.

Andy Ho

 

0
Petio Petkov
Telerik team
answered on 12 Aug 2010, 02:38 PM
Hello Andy Ho,

The problem is that the default commands are added in ControlPreRender, so that the collection could be modified in any previous stage. As a result, when the event is fired - the commands collection is still empty.
That's why we recommend to create commands dynamically.

Sincerely yours,
Petio Petkov
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
Andy Ho
Top achievements
Rank 1
Answers by
Pero
Telerik team
Andy Ho
Top achievements
Rank 1
Petio Petkov
Telerik team
Share this question
or