Hi Everyone,

My query is regarding how to retain the text box values user has entered in textbox while going to next page(Paging) in Gridview.

In Gridview I'm having six fields(columns) out of which five fields I'm binding the values from database and the sixth field is Textbox where user can enter the data.
For each page in GridView I'm dispalying five records from database.

So when I go to the 2nd page in Gridview and comes back to 1st page the values entered in the textbox are not displaying.

How can I retain the Textbox values while going to 2nd page in Grid View.

Can Someone help me regarding this!!

Regards,
Pavan Kumar

Since the web is a stateless environment this problem can be a bit difficult to overcome. When you're gridview changes pages you are basically creating a new version of the page. One way you might overcome this would be to store the values in a Session variable. Of course, depending on the amount of data this could be a lot to place in Session. Another option might be to find a way to use a hidden field to store values. Maybe someone else will know of another way.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.