Question

I have a custom control that implements IPostBackEventHandler. Some client-side events invoke __doPostBack(controlID, eventArgs).

The control is implemented in two different user controls. In one control, RaisePostBackEvent is fired on the server-side when __doPostBack is invoked. In the other control, RaisePostBackEvent is never invoked. I checked the __EVENTTARGET parameter and it does match the ClientID of the control... where else might I look to troubleshoot this?

Was it helpful?

Solution

There's a lot of ways this can fall apart. Are you adding the control to the page dynamically in code behind? If so alot of times your UniqueID can be off - even though the client id's are equal. Do you have a code sample that might demonstrate what you're doing?

OTHER TIPS

Double check that it is indeed a derivation of the UserControl class, not the WebControl one.
This one has had me by surprise many times. If you need to use WebControl for the styling, you need to let your control implement INamingContainer. (Don't worry, its a marker interface)

So..

public class MyControl : UserControl {}

Or

public class MyControl : WebControl, INamingContainer {}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top