views:

54

answers:

2

I have a custom control which is a wrapper around the ASPxGridView. This custom control is nested inside an UpdatePanel. In one of its columns I add a LinkButton, which I register by calling ScriptManager.RegisterPostBackControl.

The grid has paging enabled. Paging is of course done during an AsyncPostBack.

When the grid is showing its first page everything works as expected: the button is clicked causing a PostBack.

However, if the current page is not the first, clicking the button once does not cause a PostBack, and clicking it again (in fact clicking any button inside the column) raises an error.

This same error is thrown if I comment out the line that registers the button with the ScriptManager and click a button while on the first page.

So this leads me to think that the buttons in the first page get registered correctly because this is done during a PostBack, and that registration for the buttons in any other page fails (for some reason) because it is done during an AsyncPostBack.

Any thoughts? A possible solution?

Thanks in advance

A: 

I think that you need to re-register your Javascript that control your button after the UpdatePanel. To do that:

var prm = Sys.WebForms.PageRequestManager.getInstance();    
prm.add_initializeRequest(InitializeRequest);
prm.add_endRequest(EndRequest);

function InitializeRequest(sender, args) {      
}

function EndRequest(sender, args) {
}

Be sure to run this stript after the PageLoad, or after the script manager, to give the time to the page to load Sys object.

Aristos
Thanks for your help.
Gabriel
A: 

I solved it by setting the ASPxGridView's EnableCallbacks property to false.

Gabriel