views:

37

answers:

3

Hi Guys,

The coding is in ASP.NET C#.
I have a gridview, with say 1000 records and I am inline editing one of the rows.
On Clicking Update, I would like my Grid to be on the exact x y position it was on before the postback happened.
If you are thinking along the lines of using the Page directive, MaintainScrollPositionOnPostback="true", no, it didnt work for me
What is the most optimal method?

Regards,
naveenj

+1  A: 

Using the UpdatePanel control to wrap your grid.

Another way would be to use ajax instead like using the jqGrid component.

XIII
@kris> "like using the jqGrid component." only if it were open source
naveen
@naveen: you can download the scripts from here: http://www.trirand.com/blog/?page_id=6.
XIII
@kris> thank you very much
naveen
+1  A: 

You could use an AJAX UpdatePanel to avoid reloading the whole page. That will work even when MaintainScrollPositionOnPostback for some reason does not.

recursive
A: 

create a js method to record the current scroll position of the page to a hidden server control. you could set this up as a handler on each update button, or onscroll, or anything else that will fire after you manually scroll to your edit row and before the postback occurs.

during server processing, generate js code that will restore the scroll position. register this as a startup script.

lincolnk