Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Page 1

Status
Not open for further replies.

skip2004

Programmer
Nov 9, 2004
37
GB
I have an asp.net page which contains a datagrid. I have not enabled paging, so lots of records are displayed on the screen.

The PK of the record is displayed as a link and I have some code which handles the ItemCommand for the datagrid. This code displays a javascript popup (using response.write("<javascript.......etc). The popup is displayed OK, but the page somehow gets refreshed, which means that the screen now displays the top records again (a real pain if you want to select a number of records which are quite a way down the screen).

I've also tested this with a standard web button, positioned a short way down the screen. When clicked (and it basically runs no code), the screen again gets refreshed, and the button disappears. It seems that whenever any server side code is executed (or when the page is posted back to the server) the screen is re-rendered.

Is there any way of stopping this?

Many thanks.

 
I suspected it was the javascript function that was causing my problems, but even the web button causes the screen to be re-rendered (even though it doesn't do anything).

Perhaps this is just the way asp.net work.
 
Just testing further, if the datagrid displays 150 rows, the user may scroll to the bottom of the screen to locate the correct item in the datagrid.

Then, if the ItemCommand for the datagrid executes a simple piece of code (which could be some sort of database update), the screen is re-built and the record that the user was looking at is now no longer displayed - they would have to scroll down again to find the record.

Can this "automatic re-rendering" not be stopped? In this particular occassion it could be very frustrating if the user had to continually user the scroll bar everytime some action was taken?

Cheers...
 
You can use Smart Navigation (IE5 or better only - will not work in Netscape). In the properties window (VSNET) select "DOCUMENT". Scroll down to the smartNavigation property and set it to True.
 
Thanks Veep, that's exactly what I was looking for.

It does seem that there are a few issues with this though. I keep getting "invalid pointer" javascript errors. I have found a fix for this, but it does mean a bit of extra work.

Thanks once again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top