views:

1428

answers:

2

I already found this article:

http://www.dotnetcurry.com/ShowArticle.aspx?ID=181&AspxAutoDetectCookieSupport=1

But I've got a different situation. I am embedding some hiddenFields inside of the master page and trying to store the position of the dragPanel in those.

I am using javascript to store the position of the dragPanel and then when the user clicks on a link, the new page is loaded, but the dragPanel is reset into the starting position.

Is there any easy way to do this?

Pseudocode:

**this is in MasterPage.master**


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;

}        


<asp:Button ID="Button1" runat="server" Text="Button"/>

<asp:HiddenField ID="HiddenField1" runat="server" Value="0"

However, HiddenField is not visible in the redirected page, foo.aspx

+1  A: 

Rather than storing the position information in a hidden field, store it in a cookie. The information is small, so it will have minimal effect on the page load performance.

Colin Neller
A: 

yep, thats what i actually ended up doing, but what about the people that don't store cookies? should I care about them?

eviljack