I have a grid view and some image buttons in each row of my grid view in a web application . Every time when I scroll all the way down at the bottom of my grid view and press the image button, the grid view itself jump back to the top. I am wondering if there is a way when I press the image button in my grid view, the grid view will not go all the way back?
Asked
Active
Viewed 1,266 times
0
-
Use `SelectedIndexChanged` event in your gridview. Use `Gridview.SelectedRow.Focus();` in the event handler. – ctumturk Apr 15 '16 at 06:06
-
that event didn't fire – RedRocket Apr 15 '16 at 07:08
-
1I am sorry I missed that you use imagebuttons. I thought you select gridview row. In that case you can use `ImageButton.Focus();` inside the handler of `click` event of the corresponding imagebutton. After postback you are losing the state of the page and you need to retrieve the position of the page. Also if you don't need to focus on a specific control after postback [here](http://stackoverflow.com/questions/5147942/how-to-maintain-scroll-position-on-autopostback) is another solution to keep the position of the scrollbar which is fairly simpler. – ctumturk Apr 15 '16 at 07:22
1 Answers
0
I sorted this out on my page by adding this into <%@ Page %> section.
MaintainScrollPositionOnPostback="true"
Sorry I can't provide the link to where I got it from but all thanks to whoever that was.

Tony Hinkle
- 4,706
- 7
- 23
- 35

Matt Doran
- 11
- 3