Hi,
In my application, I have one page which contain User Control. In that User Control there is one GridView. This GridView contain around 30 fields. Due to this Horizontal scroll bar come into picture. Now my problem is that, there is dropdownlist inside GridViewRow at 18 th position, on SelectedIndexChanged event page get Partial post back as this is inside Update Panel. As it is partial post back the page position get to start of GridView.
I want to maintain it at the same where it is previously. I tried with MaintainScrollPositionOnPostback="true". It is not working.
Any help appreciated.
Regards,
Vikram
Loading
Andrew FensterPosted Mar 21, 2011, 3:47 PM
If you absolutely must maintain the horizontal scroll position, I think you're going to have to write some Javascript. You need Javascript to record the scroll position and then you need more Javascript to put the browser back to the same spot after the post back. The article I listed had one technique. There are others out there, if you spend some time searching on the Web.
VikramPosted Mar 21, 2011, 1:44 PM
I tried given solution but its not working. Actually we tried to convince client with select row and modify details. but they want excel like user experience.
Regards,
Vikram
Suthish NairPosted Mar 21, 2011, 12:51 PM
Set Focus Controls - AutoPostBack = true
Andrew FensterPosted Mar 21, 2011, 12:34 PM
You can write code to do what you want, although it's a bit of a pain. See, for example, http://www.4guysfromrolla.com/articles/111704-1.aspx
It's problems like this that have led me to prohibit editing inside the grid in all apps. It's already a bad experience. Some columns are editable and others aren't, which can be confusing. When your user has to use a horizontal scroll to edit all the columns, it's worse. Also, you end up having problems like the one you're having.
I always have the user select a row, and then I display a panel where all the values can be displayed / edited. I do the same thing even when the grid only has a few columns. That way you have the same user experience in every grid throughout the application.