This is a migrated thread and some comments may be shown as answers.

[Solved] Data Binding on Server - Paging (Newbie)

7 Answers 208 Views
Grid
This is a migrated thread and some comments may be shown as answers.
RDot
Top achievements
Rank 1
RDot asked on 12 May 2009, 03:10 PM
Hi -

 I'm doing a trial of the the Telerik grid and want to know how to do the following;

 Scenario
 1.  I databind the grid (on the server side) to a List<T> where T is a custom class.
 2.  This works fine.  The grid displays the data.

 If my grids page size is N, lets say 3 and my List<T> is > 3 items the grid does paging.  But when I try to go to the second page nothing displays.      I'm guessing the Grid is expecting a method to populate the next set of data.   

   In my instance the number of items in List<T> is so small I want ALL of the List<T> to be bound to the grid on the server side call and the grid paging to work without a server call.   Is this possible?

  I've searched the documentation and can't find anything.  

  Thanks -

  Rob

 

7 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 13 May 2009, 05:32 AM
Hello Rob,

By default RadGrid paging is disabled, i.e AllowPaging is set to false.
Thus if you DataBind it should not show any pager items.
Below links explain how RadGrid works and how you can bind it:
Event sequence
Telerik RadGrid data binding basics

If you are still experience same behavior please provide us with the markup of RadGrid and how you bind it.

Greetings,
Nikolay
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.
0
RDot
Top achievements
Rank 1
answered on 13 May 2009, 01:22 PM
Thanks for the response Nikolay.

I'm not sure i'm stating what I want to do correctly...

Here is what I want
1.  Enable paging on the grid
2.  But I only want to bind the data one time.  Say, the first time the page loads.  I don't want each time the user pages to perform a server side request.

Here is some pseudo-code for what I want...

void page_load()
{
  If (!this.IsPostBack)
  {
    this.RadGrid.DataSource = List<T>;   //Where T is any type of custom class.
    this.RagDrid.DataBind();
   }
}

Then I want the grid to have paging, and when the user moves to the next page the data would already exist on the client and no server hit would occur. 

It is like all of the data is serialized to the client during the page load and the client portion of the grid manages all the data.

Are you saying once pagng is enabled on the grid, the grid must have a server side method to call as each page is requested?

Thanks -

Rob
0
sp
Top achievements
Rank 1
answered on 14 May 2009, 08:02 PM
I have a similiar situation.
My radgrid(ajaxified) is databound using an asp button. Everytime the button is clicked a texbox value is read and used in the sqlquery parameter. I have enabled paging in the grid.
Here is my psuedocode:

Button_click()
{
    buildtable()
}

buildtable()
{
    radgrid.datasource = mydataview
    radgrid.databind()
}
radgrid_pageindexchanged()
{
    buildtable()
}

My pagesize is 6. I want the user to be able to click next page to show 7-12 records. But this is not working.

thanks for any help.
0
sp
Top achievements
Rank 1
answered on 14 May 2009, 08:58 PM
I changed the code to

Button_click()
{
    buildtable()
radgrid.databind()
}

buildtable()
{
    radgrid.datasource = mydataview

}
radgrid_pageindexchanged()
{

radgrid.CurrentPageIndex = e.NewPageIndex

buildtable()

radgrid.DataBind()


}

 

Now my grid does not update to show the new results after the button is clicked next time.

0
Nikolay Rusev
Telerik team
answered on 18 May 2009, 06:20 AM
Hello,

Rob - RadGrid does not have such behavior. If you are binding RadGrid server side if will take only PageSize records and show them. Whenever the user attempt to page RadGrid will rebind to get next PageSize records.

SP - I am afraid I do not completely understand the problem which you are facing. Can you elaborate a bit more? 

Best wishes,
Nikolay
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.
0
Ifdev02
Top achievements
Rank 1
answered on 23 Sep 2009, 08:44 AM
I also have the same problem the Grid has to be bound each postback when paging buttons are clicked. so when i have a button to modify grid it has to bind twice.. I am searching for solution as well.
0
Nikolay Rusev
Telerik team
answered on 24 Sep 2009, 03:29 PM
Hello Joe,

Please give the following a try:
http://www.telerik.com/help/aspnet-ajax/grdadvanceddatabinding.html

Regards,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
RDot
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
RDot
Top achievements
Rank 1
sp
Top achievements
Rank 1
Ifdev02
Top achievements
Rank 1
Share this question
or