Retain position of a DragPanel Extender

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nilla2010
    New Member
    • Sep 2010
    • 14

    Retain position of a DragPanel Extender

    HI,
    How to retain the position of dynamically created DragPanel Extender after postback ?.In addition i am having multiple panels dragged into the common area to draw a picture. So i have to retain the position of multiple controls.I do have code for retaining position in Javascript for server controls.

    Code:
     function pageLoad() {
                // call the savePanelPosition when the panel is moved
                $find('DragP1').add_move(savePanelPosition);
                var elem = $get("<%=HiddenField1.ClientID%>");
                if (elem.value != "0") {
                    var temp = new Array();
                    temp = elem.value.split(';');
                    // set the position of the panel manually with the retrieve value
                    $find('<%=Panel1_DragPanelExtender.BehaviorID%>').set_location(new Sys.UI.Point(parseInt(temp[0]), parseInt(temp[1])));
                }
    }
    
    function savePanelPosition() {
                var elem = $find('DragP1').get_element();
                var loc = $common.getLocation(elem);
                var elem1 = $get("<%=HiddenField1.ClientID%>");
                // store the value in the hidden field
                elem1.value = loc.x + ';' + loc.y;
    
    }
    But i dont know how to add it for dynamically created DragPanel and Images in code behind. So i do want o know to how to retain the position and capture the co-ordinates for dynamically created controls.
    Thanks,
    Last edited by Frinavale; Sep 20 '10, 01:54 PM. Reason: Fixed the code tags. The end code tags is not [End Code]...it is [/code]
Working...