views:

316

answers:

1

Hi, I am using JQuery for pagination. I have a button in that page, when clicked information is stored in back end and the page gets refreshed.

But after refreshing i am able to see the first page of pagination and not the page in which I ckicked.

+2  A: 

Save the current page in a hidden input element.

In your backend you can probably access form elements if you need to do something with the pageNumber there. In asp.net the hidden field should still contain the pageNumber so you could re-set the paging in jquery after postback.

Alternatively, you could edit the form's action attribute to set a pageNumber as an url parameter. Like this:

$("form").attr("action", "my_web_page.php?pageNumber=" + $("#my_hidden_pageNumber").val());

Then on loading your page after the postback, you set the right page in jquery again using the url parameter. There's a plugin here for easily reading url parameters: http://www.mathias-bank.de/2007/04/21/jquery-plugin-geturlparam-version-2/

Thomas Stock
Thanks this snippet is working fine
Sai Prasad
If my answer helped you, please mark it :-)
Thomas Stock