Saturday, March 24, 2012

Events not firing on custom control inside FormView inside UpdatePanel

Hi all-

I have a custom control that I have been using inside a FormView; all its events have been firing properly. Recently I placed the FormView inside an UpdatePanel, and now the events of the control are not firing.

I set the AutoPostBack property of the control to True and even turned on AutoEventWireup, but the event doesn't fire.

I tried adding the control as a Trigger on the UpdatePanel using this syntax:

<asp:AsyncPostBackTriggerControlID="FormView1:CustomControl1"EventName="SelectionChanged"/>

but the event still doesn't fire.

Am I doing this the right way? I have also posted this question on the control vendor's forum, but I thought I'd check here as well, to make sure I'm doing everything else right.

Thanks for any help...

-Andrew

Hi Andrew,

Can you post a small but full sample? It's preferred that this sample doesn't rely on a specific class or database( Use mock data created in memory instead? ) .


No,

"FormView1:CustomControl1" is not the right way, In this scenario,I think you can use FindContorl method(for more information,seehttp://forums.asp.net/t/1107107.aspx).

TheRegisterAsyncPostBackControl(Control) method enables you to register controls to perform an asynchronous postback instead of a synchronous postback which updates the entire page . When theChildrenAsTriggers property of anUpdatePanel control is set totrue (which is the default), postback controls inside theUpdatePanel control are automatically registered as asynchronous postback controls and cause a refresh of the panel content.

Use theRegisterAsyncPostBackControl(Control) method to register controls outside of anUpdatePanel control as postback controls that can perform asynchronous postbacks and potentially update the content of an update panel. To update anUpdatePanel control programmatically, call theUpdate() method.

For more information,seehttp://www.asp.net/AJAX/Documentation/Live/mref/M_System_Web_UI_ScriptManager_RegisterAsyncPostBackControl_1_62fe17e7.aspx.

Best Regards,


Hi gentlemen-

I just created a simple version of the page, and everything is working. So the problem has to be somewhere in my page. Now that I know that, I believe I can figure out the rest on my own.

Thanks for your time; next time I will just try a simplified version first!

Thanks,

-Andrew


Hi,

It is a good manner to try a simplified version first when you run into an issueSmile

Best Regards

No comments:

Post a Comment