I have an ASP.NET Web Forms application. In my application I have a GridView that works smoothly.
Suppose the GridView is placed in myPage.aspx.
If the user follow a specific url, let's say www.mywebsite.com/myPage.aspx?downloadId=n, I want my
GridView to automatically scroll to the one that has the requested download (without deleting the other rows).
I know how to get the downloadId value from the QueryString and that from the
RowDataBound I can check the items (and also retrieve the page index) and compare with the
downloadId and see if it matches, but how can I tell the
GridView to scroll there? Same discussion if I use paging, how can I tell to the GridView to go to a specific page?
What do u mean by scrolling?
If u r talking about selecting that particular row, then u already have its id, u can first change the page index
and then select that row.
But I beleive, u r talking about vertical scrolling on the page, a workaround coming to mind at the moment is
put a simple label control in item template, and then sue GridView.FindControls method to locate it
U also should look at the following:
http://www.mediacollege.com/internet/javascript/page/scroll.html
http://clifgriffin.com/2008/10/14/using-javascript-to-scroll-to-a-specific-elementobject/
Usman Waheed
Marked as answer by TRINAKRIAE on Mar 06, 2012 11:38 AM
u said, u have the particular id, so after u r changing the page, to go to relevant page, you can iterate through
the particular column and then try with selecting that row, I dont know if we can programmatically select grid view or not
give Google a shot to search: Programatically selecting gridview row
TRINAKRIAE
Member
211 Points
147 Posts
How to programmatically scroll to a specific row (and page) in a GridView
Feb 29, 2012 03:06 PM|LINK
I have an ASP.NET Web Forms application. In my application I have a GridView that works smoothly.
Suppose the GridView is placed in myPage.aspx.
If the user follow a specific url, let's say www.mywebsite.com/myPage.aspx?downloadId=n, I want my GridView to automatically scroll to the one that has the requested download (without deleting the other rows).
I know how to get the downloadId value from the QueryString and that from the RowDataBound I can check the items (and also retrieve the page index) and compare with the downloadId and see if it matches, but how can I tell the GridView to scroll there? Same discussion if I use paging, how can I tell to the GridView to go to a specific page?
Thanks!!!
gridview datarow
usman400
Contributor
3493 Points
721 Posts
Re: How to programmatically scroll to a specific row (and page) in a GridView
Feb 29, 2012 03:28 PM|LINK
gridview datarow
TRINAKRIAE
Member
211 Points
147 Posts
Re: How to programmatically scroll to a specific row (and page) in a GridView
Mar 01, 2012 08:41 AM|LINK
Thanks. What about scrolling?
gridview datarow
usman400
Contributor
3493 Points
721 Posts
Re: How to programmatically scroll to a specific row (and page) in a GridView
Mar 01, 2012 10:52 AM|LINK
What do u mean by scrolling?
If u r talking about selecting that particular row, then u already have its id, u can first change the page index
and then select that row.
But I beleive, u r talking about vertical scrolling on the page, a workaround coming to mind at the moment is
put a simple label control in item template, and then sue GridView.FindControls method to locate it
U also should look at the following:
http://www.mediacollege.com/internet/javascript/page/scroll.html
http://clifgriffin.com/2008/10/14/using-javascript-to-scroll-to-a-specific-elementobject/
TRINAKRIAE
Member
211 Points
147 Posts
Re: How to programmatically scroll to a specific row (and page) in a GridView
Mar 01, 2012 12:42 PM|LINK
Thanks, that is clear but how can I select the row? By using Focus()?
usman400
Contributor
3493 Points
721 Posts
Re: How to programmatically scroll to a specific row (and page) in a GridView
Mar 01, 2012 02:56 PM|LINK
u said, u have the particular id, so after u r changing the page, to go to relevant page, you can iterate through
the particular column and then try with selecting that row, I dont know if we can programmatically select grid view or not
give Google a shot to search: Programatically selecting gridview row