Get Gridview Page Size

Posted by Rajesh_Kumar under jQuery on 7/1/2015 | Points: 10 | Views : 699 | Status : [Member] [MVP] | Replies : 4
Hi All,
How to get Gridview Page Size using jQuery?

Rejesh Kumar


Responses

Posted by: Sheonarayan on: 7/2/2015 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
To get GridView page size in jQuery you can do following.

Step 1: In the server side, declare a page level public variable like
public string _pageSize = string.Empty;

Step 2: Set its value in the method like this
_pageSize = GridView1.PageSize.ToString();

Step 3: In .aspx or view page write following
<script
var pageSize = '<%= _pageSize %>';
</script>

This will give you pageSize variable in the JavaScript that you can use in jQuery.

Hope this helps.

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Rajesh_Kumar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rajesh_Kumar on: 7/3/2015 [Member] [MVP] Silver | Points: 25

Up
0
Down
Hi Sheonarayan,
The solution you provided will run on .aspx pages but we have our own Framework where there is no aspx pages.
Everything is in jquery or class file.and sometime,we have to override some framework method and write in jqery.
So,kindly provide me solution in terms of pure jquery.We also do not have hidden field as well as viewstate.

Rejesh Kumar

Rajesh_Kumar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sheonarayan on: 7/3/2015 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
It's difficult to give you the solution without seeing the actual code as you said your framework is different. However, I feel you must have some way to get the count of the record being bound to the GridView and hold it on the server side variable and then write it in the view page.

If your view page can write variable value from the server side, it is doable the way I showed you above.

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Rajesh_Kumar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sojanya on: 7/6/2015 [Member] Starter | Points: 25

Up
0
Down
Hi Rajesh_Kumar,

Which framework are you working on?
How are binding data in grid... is it on page_load itself or asynchronously after page load?

Thanks,
Sojanya Tripathi

Rajesh_Kumar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response