shouldn't the DIV remember this? : DOTNET
This is a discussion on shouldn't the DIV remember this? within the DOTNET forums in Framework and Interface Programming category; hey all, i have a div on my page where i set the ScrollLeft value. when i do a postback the div is set back to 0. i've made the DIV runat server and enabled viewstate. what would i have to do to make this work? thanks, rodchar...
| DOTNET Discussion forums related to Microsoft Dot net technologies, CSharp and other related items |
![]() |
| | LinkBack | Thread Tools |
|
#1
| |||
| |||
| i have a div on my page where i set the ScrollLeft value. when i do a postback the div is set back to 0. i've made the DIV runat server and enabled viewstate. what would i have to do to make this work? thanks, rodchar |
|
#2
| |||
| |||
| Are you setting ScrollLeft using JavaScript or during a postback? If you are setting it using JavaScript it will not be remembered because the JavaScript will not modify the ViewState. It may also be helpful if you showed us your code. -- Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/ "rodchar" <rodchar@discussions.microsoft.com> wrote in message news:A102FB1B-8EF2-475A-85FE-176DD042CAB8@microsoft.com... > hey all, > i have a div on my page where i set the ScrollLeft value. when i do a > postback the div is set back to 0. i've made the DIV runat server and > enabled > viewstate. what would i have to do to make this work? > > thanks, > rodchar |
|
#3
| |||
| |||
| yes i am setting value using javascript that's in the head section. so do i have any options this way? <script language="javascript" type="text/javascript"> // <!CDATA[ function scrollDiv(direction){ y=document.getElementById("OnlyDIV") y.scrollLeft=(direction=="left")?y.scrollLeft-75:y.scrollLeft+75 c.value=y.scrollLeft; } <html> .... <input id="BtnLeft" style="width: 46px; height: 24px" type="button" value="Left" onclick="scrollDiv('left')" /> "Nathan Sokalski" wrote: > Are you setting ScrollLeft using JavaScript or during a postback? If you are > setting it using JavaScript it will not be remembered because the JavaScript > will not modify the ViewState. It may also be helpful if you showed us your > code. > -- > Nathan Sokalski > njsokalski@hotmail.com > http://www.nathansokalski.com/ > > "rodchar" <rodchar@discussions.microsoft.com> wrote in message > news:A102FB1B-8EF2-475A-85FE-176DD042CAB8@microsoft.com... > > hey all, > > i have a div on my page where i set the ScrollLeft value. when i do a > > postback the div is set back to 0. i've made the DIV runat server and > > enabled > > viewstate. what would i have to do to make this work? > > > > thanks, > > rodchar > > > |
|
#4
| |||
| |||
| There is no way to have ViewState remember values set using JavaScript, but what you can do is create an <input type="hidden"> and set the value property as part of the function. Then when you postback you can have ASP.NET use that value when generating the returned page. This is usually the best way to avoid losing values set by JavaScript. Good Luck! -- Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/ "rodchar" <rodchar@discussions.microsoft.com> wrote in message news:6BB1F12E-7C3A-4D9E-95F2-8433D00681C0@microsoft.com... > yes i am setting value using javascript that's in the head section. so do > i > have any options this way? > > <script language="javascript" type="text/javascript"> > // <!CDATA[ > function scrollDiv(direction){ > y=document.getElementById("OnlyDIV") > y.scrollLeft=(direction=="left")?y.scrollLeft-75:y.scrollLeft+75 > c.value=y.scrollLeft; > } > > <html> > ... > <input id="BtnLeft" style="width: 46px; height: 24px" > type="button" value="Left" > onclick="scrollDiv('left')" /> > > > "Nathan Sokalski" wrote: > >> Are you setting ScrollLeft using JavaScript or during a postback? If you >> are >> setting it using JavaScript it will not be remembered because the >> JavaScript >> will not modify the ViewState. It may also be helpful if you showed us >> your >> code. >> -- >> Nathan Sokalski >> njsokalski@hotmail.com >> http://www.nathansokalski.com/ >> >> "rodchar" <rodchar@discussions.microsoft.com> wrote in message >> news:A102FB1B-8EF2-475A-85FE-176DD042CAB8@microsoft.com... >> > hey all, >> > i have a div on my page where i set the ScrollLeft value. when i do a >> > postback the div is set back to 0. i've made the DIV runat server and >> > enabled >> > viewstate. what would i have to do to make this work? >> > >> > thanks, >> > rodchar >> >> >> |
|
#5
| |||
| |||
| thank you for the help. rod. "Nathan Sokalski" wrote: > There is no way to have ViewState remember values set using JavaScript, but > what you can do is create an <input type="hidden"> and set the value > property as part of the function. Then when you postback you can have > ASP.NET use that value when generating the returned page. This is usually > the best way to avoid losing values set by JavaScript. Good Luck! > -- > Nathan Sokalski > njsokalski@hotmail.com > http://www.nathansokalski.com/ > > "rodchar" <rodchar@discussions.microsoft.com> wrote in message > news:6BB1F12E-7C3A-4D9E-95F2-8433D00681C0@microsoft.com... > > yes i am setting value using javascript that's in the head section. so do > > i > > have any options this way? > > > > <script language="javascript" type="text/javascript"> > > // <!CDATA[ > > function scrollDiv(direction){ > > y=document.getElementById("OnlyDIV") > > y.scrollLeft=(direction=="left")?y.scrollLeft-75:y.scrollLeft+75 > > c.value=y.scrollLeft; > > } > > > > <html> > > ... > > <input id="BtnLeft" style="width: 46px; height: 24px" > > type="button" value="Left" > > onclick="scrollDiv('left')" /> > > > > > > "Nathan Sokalski" wrote: > > > >> Are you setting ScrollLeft using JavaScript or during a postback? If you > >> are > >> setting it using JavaScript it will not be remembered because the > >> JavaScript > >> will not modify the ViewState. It may also be helpful if you showed us > >> your > >> code. > >> -- > >> Nathan Sokalski > >> njsokalski@hotmail.com > >> http://www.nathansokalski.com/ > >> > >> "rodchar" <rodchar@discussions.microsoft.com> wrote in message > >> news:A102FB1B-8EF2-475A-85FE-176DD042CAB8@microsoft.com... > >> > hey all, > >> > i have a div on my page where i set the ScrollLeft value. when i do a > >> > postback the div is set back to 0. i've made the DIV runat server and > >> > enabled > >> > viewstate. what would i have to do to make this work? > >> > > >> > thanks, > >> > rodchar > >> > >> > >> > > > |
![]() |
« Previous Thread
|
Next Thread »
| Thread Tools | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Trying to remember .... | usenet | Scheme | 2 | 05-02-2007 04:58 AM |
| Anyone remember an ado.net cheatsheet on the web? | usenet | ADO DAO RDO RDS | 0 | 03-19-2007 01:02 PM |
| i remember... | usenet | awk | 2 | 12-14-2006 10:20 AM |
| Something to remember | usenet | ADO DAO RDO RDS | 0 | 03-08-2006 11:57 AM |
| OWA Does not Remember PAssword | usenet | Microsoft Exchange | 0 | 08-27-2004 10:50 AM |
All times are GMT -5. The time now is 08:32 AM.


