What does this do?

2 posts, 0 answers
  1. Angela
    Angela avatar
    19 posts
    Member since:
    Mar 2008

    Posted 08 Apr 2008 Link to this post

    ScriptManager

    .RegisterStartupScript(
    rdTemp,
    this.GetType(),
    "AddDock",
    tring.Format(@"function _addDock() {{" +
    "Sys.Application.remove_load(_addDock);" +
    "$find('{1}').dock($find('{0}'));" +
    "$find('{0}').doPostBack('DockPositionChanged');" +
    "}};" +
    "Sys.Application.add_load(_addDock);", rdTemp.ClientID, sZone), true);

    In General I get the registerStartupScript...

    What what is the javascript doing? Can someone break it down?

    This is from the portalsitecs.zip I downloaded.....

    Appreciate some helpe with understanding it....

  2. Obi-Wan Kenobi
    Obi-Wan Kenobi  avatar
    460 posts
    Member since:
    Aug 2007

    Posted 11 Apr 2008 Link to this post


    1) Ajax is finished - newly created RadDock is on the page- but it is not docked, because it is added in the UpdatePanel
    2)Sys.Application.add_load(_addDock);
    function _addDock will be executed
    3)Sys.Application.remove_load(_addDock);
    function _addDock will not be executed anymore(It will be executed only once - when the RadDock is loaded for the first time on the page.)
    4) $find('{1}').dock($find('{0}'));" - The newly created dock is docked in the RadDockZone
    5) "$find('{0}').doPostBack('DockPositionChanged');"-DockPositionChanged event is fired on the server. A trigger is already added to the DockPositionChanged Event, so when it is fired the state will be saved on the server via AJAX

Back to Top