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

Pager Disappear Problem

3 Answers 108 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Punit
Top achievements
Rank 1
Punit asked on 05 Sep 2008, 11:12 AM
Hi

I have wrapped RadGrid into another grid as a server control.

I also have created a Paging control as server control containing Drop Downs and Buttons to be put on grid. 

1. The drop downs on Pager server control depend on Gris's total no of row. 

2. The Paging server control inherits from ITemplate and is set as Grid.MasterTableView.PagerTemplate.

3. Paging Control also bubbles up drop down change event to grid server control.

Issue:
I wasn't able to add the paging control on ItemCreated Function.
In Constructor it does add control to grid but Grid's properties's values are not available so I cannot create pager control's drop downs.
On Load function the grid's properties are available and it does add on intial page load but it does not draw paging control on post back.

I need help as to in which which fucntion(s) of Grid can I attach PagerControl to Server Control so that I can achieve all 3 on initial page loads and on post back.
 
Please let me know if some work around is needed.


3 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 08 Sep 2008, 02:01 PM
Hello Punit,

Without knowing the details of your project, here is the general approach in such cases. Your DropDown controls cannot register their event handlers anywhere except for the Init and Load events of the custom control. Therefore, you need to register their event handlers at this stage. This means that it is also advisable to specify RadGrid's PagerTemplate again in Init/Load. As for binding your dropdowns, RadGrid's PreRender event is also suitable for this job, because RadGrid is ready for rendering at this stage. This means that you can get to the item count, page count and all the other properties you need. Please note, however, that you cannot register dropdownlist events at this stage, so your pager control needs to be already initialized. You simply specify the dropdown items in PreRender.

Please see how this applies to your case.

Sincerely yours,
Veli
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Punit
Top achievements
Rank 1
answered on 09 Sep 2008, 11:39 AM
Thanks.

Actually the first probelm is. if I wrap Radgrid into a my own server control and I also have a customized paging control which is again a server control then the paging control shoul inherit from Itemplate or should it just inherit from Control.

if it inherits from ITemplate then I can assign it to MasterTableView.PagerTemplate.

What is the right method of my server control in which I should add this?
0
Veli
Telerik team
answered on 09 Sep 2008, 06:38 PM
Hi Punit,

Definitely, if you have a PagerTemplate that is a custom user control by itself, it should implement the ITemplate interface, and you need to attach it to your MasterTableView.PagerTemplate in Page_Init/Page_Load, based on how you define your RadGrid control. If your RadGrid control is defined all in the code-behind, every initialization, including the PagerTemplate assignment needs to be done in the Init event. If your RadGrid is defined in the markup and has its properties set in the code-behind, this should be done in the Load event.

Here are a few help articles for you to consider:

Declarative definition

Programmatic creation

Loading user control with RadGrid at runtime

Setting pager template

Best wishes,
Veli
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Punit
Top achievements
Rank 1
Answers by
Veli
Telerik team
Punit
Top achievements
Rank 1
Share this question
or