datagrid in a div for scrolling question

G

Guest

I have a datagrid in a divtag for scrolling. On post back is there a way to
hold position in the datagrid / div combo so that it posts and then returns
to the post where the selection was made?
thanks
kes
 
G

Guest

For IE >= 5.0 try <% Page SmartNavigation="True">
You can also use anchors (see <a> tag reference)
 
J

jasonkester

You can trap the onscroll event in javascript and store the scroll
position in a hidden input field. Then put some more script into
window.onload to pull that position out of the hidden field and set the
scroll position.

Here is a quick example that should get you pointed in the right
direction. It has all the client code you'll need (in IE, at least):

<div id="divTest" style="width:200;height:100;overflow:auto"
onscroll="divTest_onscroll()">
put a bunch of text here so that the scrollbars will display...
</div>

<script>
function divTest_onscroll()
{
var div = document.getElementById("divTest");
alert(div.scrollTop);
}

function SetScroll()
{
var div = document.getElementById("divTest");
div.scrollTop = 50;
//alert(div.scrollTop);
}
SetScroll();
</script>


Good luck!

Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top