Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


vb Move gridview selected row to top.

vb Move gridview selected row to top.

vb Move gridview selected row to top.

I have a gridview with 168 rows. When I select a row I want that row to highlight (which it is ) but I also want it to become the top row in the gridview or at least postback to the selected row.

I've had the page directive set to "MaintainScrollPositionOnPostback ="true" "
Focus() - ing it wont move it.

Any Ideas been researching this for an hour with no luck. I might not be phrasing it correctly or something



RE: vb Move gridview selected row to top.

Do you mean you want to scroll the page to the row that is selected and have it at the top of the page.
First I suggest using paging.
Second, you will need to use javascript to do the scrolling. I suggest you look into JQuery to make task a bit easier.

RE: vb Move gridview selected row to top.


I'd be happy if the selected row remained in view although I would prefer at top.
I'm so used to doing it easily with the datagridview in a form. The datagrid is a different story HA.
OK I'll give the paging a while and look into the Jquery.

Thank you


RE: vb Move gridview selected row to top.

Web Forms vs Windows Forms is very different.
What you want can be done in a few ways:
1.) There are probably 3rd party controls like the Telerik RadGrid that can do it.
2.) Client side: Call a handler to get the data and use javascript to sort the rows and put your selected row on top.
3.) Server side: When selected, post back to the server, retrieve data again and force your row to the top with sorting (I would us a stored procedure to get and sort the data)

RE: vb Move gridview selected row to top.

Thanks JB.

Prbly go with option #3. Not sure yet. I've moved on in the project and will come back to it in a few days or so :).

Thanks Again


RE: vb Move gridview selected row to top.

sure, glad to help
post back with what you did

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close