|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
asp.net c# UserControl
I have a UserControl that works.
It's an abstract class which inherits System.Web.UI.UserControl I declare it in the parent protected classname controlname; When I compile my project, I get a warning error in the Task List saying The type 'System.Web.UI.UserControl' has no event named 'CancelEvent'. It seems to be coming from my InitializeComponent() function in the parent where I add the usercontrol event that ties the usercontrol event to the parent eventhandler - this.ctlAddNewRule.CancelEvent += new NewRulePanel.CancelEventHandler(this.OnCancelNewRu leEvent); I can't find any explanation for this. Thanks, Dawn. |
|
#2
|
|||
|
|||
|
Remove that line of code, and the warning should go away.
|
|
#3
|
|||
|
|||
|
If I remove the event in the parent
this.ctlAddNewRule.CancelEvent += new NewRulePanel.CancelEventHandler(this.OnCancelNewRu leEvent); the parent that contains the UserControl won't be triggered to perform the appropriate functions that occur after either the Add or Cancel Add done in the UserControl. What I don't understand is why my public event in my class, that inherits from UserControl, is generating a warning that the event doesn't exist in the UserControl class? |
|
#4
|
|||
|
|||
|
Not sure if you figured this out because this thread is a bit old but here is the solution.
Change your event declaration to private from public private event [delegate] eventname; that should do it. Pretty simple. |
|
#5
|
|||
|
|||
|
Addition to previous messge:
To fix this problem I removed the Event Hookup from the InitComponet and added it to the page_onload event. This seems to have fixed the problem. For some reason the IDE does not allow the custom event hookups to reside in the Initcomponent and removes the code. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > ASP Development > asp.net c# UserControl |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|