I'm loading my Radgrid programmatically:
if (!IsPostBack)
{
var gridDS = from statements in db.tblEstatementDetails
where statements.EpageStatementId == Convert.ToInt64(cardType)
join card in db.tblEpageStatements on statements.EpageStatementId equals card.EpageStatementId
select new
{
statements.EstatementDetailId,
card.CardName,
};
RadGrid1.DataSource = gridDS;
RadGrid1.AllowPaging = true;
RadGrid1.DataBind();
}
Umm but when the records exceed 10 then the pagination options are available which is great. However when I click next, or previous or even try to expand my record list from '10' to say '20' then the grid just empties as if the Radgrid is not databound any more.
6 Answers, 1 is accepted
Please note that simple data-binding through the DataBind() method can be used in simple cases when you do not require the grid to perform complex operations such as paging.
For advanced features such as paging, grouping, sorting etc., please bind your grid with data through the NeedDataSource event. When using the NeedDataSource event, RadGrid can automatically accommodate the appropriate database operations without the need for you explicitly handle any sorting, paging, grouping, and so on.
I hope this helps.
Sincerely yours,
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.

In my case, I did bind RadGrid through NeedDataSource event because the number of record pulled on RadGrid is driven by different RadTabStrip click. I had the Mode of PagerStyle set to "NextPrevAndNumeric"; The grid did display various pages based on the number buttons clicked. but the previous ( < ) and next button( > ) never seem to work? Do you know what I have missed?
Thanks,

var v = (from o in sourceData
select o).Skip(grid.CurrentPageIndex * grid.PageSize).Take(grid.PageSize);
grid.DataSource = v;
you will also need to set the VirtualItem count on the grid so that it knows how to correctly setup the paging.

Thanks for your quick reply.
I am not familiar with the syntax of "(from o in sourceData select o).Skip(grid.CurrentPageIndex * grid.PageSize).Take(grid.PageSize)" ? How do I change my RadGrid datasource from a 'select' DataObjectMethod to the query above?
Thanks,

List
<Order> list = new List<Order>();
list = GetOrders(empID);
var query = (from o in list select o).Skip(RadGrid1.CurrentPageIndex * RadGrid1.PageSize).Take(RadGrid1.PageSize);
RadGrid1.DataSource = query;
I placed the above code on the NeedDataSource event, it shows only the first page which has 10 records as is defined in PageSize. But when I clicked on the next (number) button, the grid does not display any record even though it a total of 246 records? Where should I put the above code?
