Dock commands

9 posts, 0 answers
  1. shimon
    shimon avatar
    37 posts
    Member since:
    Apr 2007

    Posted 19 Jun 2007 Link to this post

    Hello,

    I want the Edit commnd that i add not to postback (i postback it at client side). but if i do CommandsAutoPostBack= false the close command dont postback even if i set its autopostback to true.

    Dock.CommandsAutoPostBack =
    true;

    DockCommand DockCommand = new DockCommand();
    DockCommand.AutoPostBack = false;
    DockCommand.OnClientCommand = "OpenXAppProperties";
    DockCommand.Name =
    "Edit";

    Is this a bug?

    Thanks,
    Shimon Shed

  2. Petya
    Admin
    Petya avatar
    869 posts

    Posted 19 Jun 2007 Link to this post

    Hello,

    Please, try the following code:

            //Raddock1.CommandsAutoPostBack = true;
            DockCommand dockCommand = new DockCommand();
            dockCommand.AutoPostBack = false;
            DockCommand.OnClientCommand = "OpenXAppProperties";
            dockCommand.Name = "Edit";
            dockCommand.Text = "Edit";

            DockCloseCommand closeCommand = new DockCloseCommand();
            closeCommand.AutoPostBack = true;
            Raddock1.Commands.Add(dockCommand);
            Raddock1.Commands.Add(closeCommand);

    where RadDock1 is the the dock to which we add the commands. Let me know if this helps.

    Regards,
    Petya
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. shimon
    shimon avatar
    37 posts
    Member since:
    Apr 2007

    Posted 19 Jun 2007 Link to this post

    Hello,

    Your fix fixed the DockCommand but the DockCloseCommand dont postback any more.

    my code is:

    private
    void CreateSaveStateTriggers(XApp.XApp Dock)
    {
    Dock.OnClientInitialize =
    "RadDockInitialize";
    Dock.AutoPostBack =
    true;
    //Dock.CommandsAutoPostBack = true;

    AsyncPostBackTrigger
    saveStateTrigger = new AsyncPostBackTrigger();
    saveStateTrigger.ControlID = Dock.ID;
    saveStateTrigger.EventName =
    "DockPositionChanged";

    UpdatePanel2.Triggers.Add(saveStateTrigger);
    saveStateTrigger =
    new AsyncPostBackTrigger();
    saveStateTrigger.ControlID = Dock.ID;
    saveStateTrigger.EventName =
    "Command";
    UpdatePanel2.Triggers.Add(saveStateTrigger);
    }

    private void CreateCommands(XApp.XApp Dock)
    {
    Dock.Command +=
    new DockCommandEventHandler Dock_Command);
    //Currently, there is a problem with the XApp.XApp command items:
    // if they are not explicitly created, the Command event it not fired.
    DockCloseCommand CloseCommand = new DockCloseCommand();
    CloseCommand.AutoPostBack =
    true;
    Dock.Commands.Add(CloseCommand);
    DockCommand DockCommand = new DockCommand();
    DockCommand.AutoPostBack =
    false;
    DockCommand.OnClientCommand =
    "OpenXAppProperties";
    DockCommand.Name =
    "Edit";
    DockCommand.Text =
    "Edit";
    Dock.Commands.Add(DockCommand);
    }

    protected void Dock_Command(object sender, DockCommandEventArgs e)
    {
    switch (e.Command.Name)
    {
    case "Close":
    ScriptManager.RegisterStartupScript(
    UpdatePanel2,
    this.GetType(),
    "RemoveDock",
    string.Format("function _removeDock() {{" +
    "Sys.Application.remove_load(_removeDock);" +
    "$find('{0}').undock();" +
    "$get('{1}').appendChild($get('{0}'));" +
    "$find('{0}').doPostBack('DockPositionChanged');" +
    "}};" +
    "Sys.Application.add_load(_removeDock);", ((XApp.XApp)sender).ClientID, UpdatePanel2.ClientID),
    true);
    break;

    case "Edit":
    XApp.XApp Dock = (sender as XApp.XApp);
    if (Dock != null)
    {
    XApp.
    XApp XApp = (DockLayout.FindControl(Dock.ID) as XApp.XApp);
    if (XApp != null)
    {
    XApp.Title = (Session[
    "BoxTitle"] as string);
    XApp.BackColor = (
    Color)Session["BoxColor"];
    }
    }
    break;
    }
    }

    Thanks,
    Shimon Shed

  4. Petya
    Admin
    Petya avatar
    869 posts

    Posted 19 Jun 2007 Link to this post

    Hi,

    I noticed from your code that you are creating the RadDocks dynamically in a manner very similar to our MyPortal example. Therefore, I am attaching our MyPortal example modified so that the RadDocks have a close command which postbacks and a custom (edit) command which does not postback. Please, note that in the server-side handler I am registering a script that displays a simple alert which will indicate to you that the handler has been executed. In the same way another alert would be shown if the Edit command postbacks, but since it does not you will never see it. I am attaching a movie as well. Hope this helps.


    Regards,
    Petya
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. shimon
    shimon avatar
    37 posts
    Member since:
    Apr 2007

    Posted 19 Jun 2007 Link to this post

    Hello,

    I did the same as you show in your example, but it still not working.
    I implement the PortalSiteCS example.

    Thanks,
    Shimon Shed
  6. Petya
    Admin
    Petya avatar
    869 posts

    Posted 19 Jun 2007 Link to this post

    Hello,

    At this point I can only kindly ask you to send us some sample running project that reproduces the issues you have, steps to reproduce them and we will work on it and do our best to help you as soon as possible. Also, which version of the control are you using - any of the hotfixes - if so, which hotfix? Looking forward to your reply.


    Sincerely yours,
    Petya
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  7. shimon
    shimon avatar
    37 posts
    Member since:
    Apr 2007

    Posted 19 Jun 2007 Link to this post

    Hello,

    i'm using hotfix 2007.01.0612.0 .
    i could send you the source of the project but it uses a database.

    please tell me how you want my example?

    thanks,
    shimon shed
  8. Petya
    Admin
    Petya avatar
    869 posts

    Posted 19 Jun 2007 Link to this post

    Hi,

    Thanks for the information you provided. Actually there is a bug with the AutoPostBack of RadDocks which is fixed in the 2007.01.0615.0 hotfix. I did not reproduce your problem because I was using this latest hotfix. Trial version you can find here. Please, test with it and let me know if you still have the same problems.

    Sincerely yours,
    Petya
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  9. shimon
    shimon avatar
    37 posts
    Member since:
    Apr 2007

    Posted 19 Jun 2007 Link to this post

    Hi,

    thank you, that hotfix fixed the problem.

    thanks,
    shimon shed
Back to Top