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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vb Move gridview selected row to top. 1

Status
Not open for further replies.

Dashley

Programmer
Dec 5, 2002
925
0
0
US
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

Thanks

-dan
 
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.
 
Hi,


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

-dan




 
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)
 
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

-dan


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top