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

[Solved] Programmatically created RadGrid - Paging not working

1 Answer 189 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Stephan Reisinger
Top achievements
Rank 1
Stephan Reisinger asked on 10 Mar 2010, 10:37 AM
I am using the following code:

                           Dim o_Grid As New Telerik.Web.UI.RadGrid 
 
                            o_Grid.ID = o_I.GUID.ToString 
                            o_Grid.AllowPaging = o_Table.Rows.Count > 10 
                            o_Grid.ShowStatusBar = o_Table.Rows.Count > 10 
                            o_Grid.Width = Unit.Percentage(100) 
                            o_Grid.RegisterWithScriptManager = True 
                            o_Grid.EnableEmbeddedScripts = True 
 
                            AddHandler o_Grid.NeedDataSource, AddressOf _GridsNeedDataSource 
                            AddHandler o_Grid.PageIndexChanged, AddressOf _GridsPageIndexChanged 
                            AddHandler o_Grid.ColumnCreated, AddressOf _GridsColumnCreated 
 
                            Debug.WriteLine(String.Format("Grid.UniqueID: {0}", o_Grid.UniqueID)) 
 
                            o_SerialNumbers.Controls.Add(o_Grid) 
 
                            o_Proxy.AjaxSettings.AddAjaxSetting(o_Grid, o_Grid) 

to dynamically, programmatically add a number of different grids to a Web Content Form during the Page_Load

Fine and dandy.

The Initial .NeedDataSource is fired and the grids are populated correctly, paging enabled/disabled etc.
Here comes what I have not been able to get to work.

Once I click the page "2" button or the "next page" etc ... the AjaxRequest fires correctly but no NeedDataSource or PageIndexChanged ... I can't wrap my head around it.

Bout the second problem I've had in 5y of using Telerik and not being able to figure out a solution by reading the documentation, forums, kb etc.

Anybody have any idea ?

o_Proxy = RadAjaxManagerProxy
o_SerialNumbers = RadAjaxPanel

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 10 Mar 2010, 02:03 PM
Hello Stephan,

Please, note that when using the NeedDataSource event RadGrid automatically accommodate the appropriate database operations without the need for you explicitly handle any paging, sorting, grouping, and so on.

Additionally, for more information about how to create the RadGrid control dynamically, please refer to the articles below:
Programmatic creation
OnPageLoad

All the best,
Pavlina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Stephan Reisinger
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or