Nandini
Nandini

Reputation: 393

Redirecting to a specified page in a gridview in asp.net

In my application I have a gridview in which details of containers are stored and displyed.

There are many containers in this gridview, say more than 150 containers. I have implemented paging for this gridview as it contains many record. But its difficult for the user to go to every page and search one particular container. So i want a serach option for this.

What I need is to enter a containernumber in a textbox and when I click a button, it should redirect to that particular page in the gridview where that particular containernumber exists.

What should be done for this? I need the exact code. Please help.

Upvotes: 0

Views: 1257

Answers (2)

The King
The King

Reputation: 4650

Sorry, I don't have an exact answer for your question... but have a sugession...

Instead of Scrolling the grid view to the position of the container... consider showing the details of container being searched seperately in a popup or page... You can even use details view or Form view to accomplish this.

Edit : Just incase you want to stick to yours.. you may first need to calculate the page in which the particular record might be and then set the pageindex property of the Gridview to that page. (as mentioned by David)

Upvotes: 0

David-79
David-79

Reputation: 31

this will take your gridview to page #4: gridView1.PageIndex = 4

Upvotes: 1

Related Questions