Close Command

6 posts, 1 answers
  1. Andy Ho
    Andy Ho avatar
    41 posts
    Member since:
    May 2010

    Posted 04 Aug 2010 Link to this post

    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

                   

  2. Answer
    Pero
    Admin
    Pero avatar
    1156 posts

    Posted 06 Aug 2010 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Andy Ho
    Andy Ho avatar
    41 posts
    Member since:
    May 2010

    Posted 07 Aug 2010 Link to this post

    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


  5. Andy Ho
    Andy Ho avatar
    41 posts
    Member since:
    May 2010

    Posted 07 Aug 2010 Link to this post

    Forget to tell, I'm using the "Outlook" skin.
  6. Andy Ho
    Andy Ho avatar
    41 posts
    Member since:
    May 2010

    Posted 08 Aug 2010 Link to this post

    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

     

  7. Petio Petkov
    Admin
    Petio Petkov avatar
    825 posts

    Posted 12 Aug 2010 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017