tags:

views:

28

answers:

3

gridview has 20 pages. The user is see first gridview page . He decide to apply highlite style using jquery on few row . Now he move to second page . He apply style this page too. Now when he go back to first page, he cannot see row with style he apply before he move to page 2.

How to store state of the rows style when user moving on pages? Perdon my English

A: 

I would save the highlighted row id's in a hiddenfield. Pageing causes a Postback! Also you need some javascript code to re-highlight the fields.

Arthur
please give sample to see
Mario
Sorry, I have no sample for that Task. But what is your Job: You've registered an event for highlighting a Row. Great - add the row's ID to a hidden field. Then add some startup javascript code which highlights your rows (you have that code) based on the hidden fields value.
Arthur
+1  A: 

Use a cookie to store highlighted rows on a given page. Hook up to a event on which highlighting takes place (click?) and add a code to rewrite a cookie with currently selected rows. When you will be printing the table just read the cookie and restore selections based on the value stored in it.

RaYell
A: 

If can afford to make the solution less efficient, I would change the highlight method so that in runs server side with a post back instead of using JavaScript and then put the GridView in a UpdatePanel.

Also remember to use DataSource object (e.g. ObjectDataSource) instead of binding your data manually using .DataBind() in the code behind. This should ensure that you don't rebind the data on every post back.

Jan Aagaard