'Custom Paging with Radgrid not working
I was looking at the answers from different questions here but cant get to something that I can use, I am new to the RadGrid stuff had always used GridView but now, they changed them all to RadGrids and one of them needs to have the paging custom, there is an example here and I am trying to use it but i am not sure how to do it if my data source is a data set see below
AdminManager adminMan = new AdminManager();
DataSet ds = adminMan.GetProducts();
int startRowIndex = (ShouldApplySortFilterOrGroup()) ?
0 : Grid.CurrentPageIndex * Grid.PageSize;
int maximumRows = (ShouldApplySortFilterOrGroup()) ?
**HERE NOT SURE HOW TO TRANSLATE THIS SO THAT I CAN USE IT
MyBusinessObjectCollection1.SelectCount() : RadGrid1.PageSize;**
Grid.AllowCustomPaging = !ShouldApplySortFilterOrGroup();
**HERE NOT SURE HOW TO TRANSLATE THIS SO THAT I CAN USE IT
RadGrid1.DataSource = MyBusinessObjectCollection1.Select(startRowIndex, maximumRows);**
As you can see i am not sure how to trnaslate that example code when using a data set. See the parts where I am noting "Here not sure how to translate...." Any help would be appreciated.
Regards
Solution 1:[1]
this worked for me.
$('.rgPageFirst').live('click', function () {
__doPostBack(this.name, '');
return false;
});
$('.rgPageNext').live('click', function () {
__doPostBack(this.name, '');
return false;
});
$('.rgPagePrev').live('click', function () {
__doPostBack(this.name, '');
return false;
});
$('.rgPageLast').live('click', function () {
__doPostBack(this.name, '');
return false;
});
$('.rgCollapse').live('click', function () {
__doPostBack(this.name, '');
return false;
});
$('.rgExpand').live('click', function () {
__doPostBack(this.name, '');
return false;
});
$('.rgExrgNumPart').live('click', function () {
__doPostBack(this.name, '');
return false;
});
Solution 2:[2]
I can't add a comment, but I can post an answer. Joe had the right idea. I just had to change it to the below code and add it to the script block of my aspx page.
$(function () {
$('.rgPageFirst').click('click', function () {
__doPostBack(this.name, '');
return false;
});
$('.rgPageNext').click('click', function () {
__doPostBack(this.name, '');
return false;
});
$('.rgPagePrev').click('click', function () {
__doPostBack(this.name, '');
return false;
});
$('.rgPageLast').click('click', function () {
__doPostBack(this.name, '');
return false;
});
});
Thanks Joe!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Joe |
| Solution 2 | DwankyDan |
