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

[Solved] RegisterPostBackControl After 1st Partial PostBack?

1 Answer 396 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ben
Top achievements
Rank 1
Ben asked on 04 Jun 2015, 01:31 PM

I have a RADGrid using AJAX where I create a custom ButtonColumn. This column holds buttons (obviously) which need to use Full-PostBacks rather than Partial-PostBacks. The grid also allows for paging. In the grid's ItemCreated() event I add the visible buttons (ie: the first 10 items if paging is set to 10 items per page) to the ScriptManager's RegisterPostBackControl() method. This works perfectly fine.

The problem I have is that when a user jumps to another page, they are causing a Partial-PostBack which redraws the grid with the next set of records to be viewed, which also runs the code to RegisterPostBackControl's. However, these buttons do not perform Full-PostBacks...they stay as Partial-PostBack controls. It seems that the ScriptManager.RegisterPostBackControl() method does not function when called from a Partial-PostBack.

Anyone know how I can add the buttons within the grid to the list of Full-PostBack controls when a user moves to another page of records within the grid?

 

-Ben

1 Answer, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 09 Jun 2015, 06:55 AM
Hi Ben,

Another possible solution to cancel the ajax is to hook OnRequestStart client event. Nevertheless the ID of the buttons in the ButtonColumn is automatically assigned and it will be hard to check whether the control which fired the ajax is the button or any other element of the grid. For this purpose I would recommend you to use a TemplateColumn with a Button control as an ItemTemplate and this way you can check the ID of the button when canceling the ajax. For your convenience I prepared a small runnable sample and attached it to this thread.

Regards,
Kostadin
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Ben
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Share this question
or