Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
User Control - raising an event
Message
General information
Forum:
ASP.NET
Category:
Other
Environment versions
OS:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01327983
Message ID:
01328076
Views:
18
>>
>>Do you have samples or ideas how this should be done?
>>
>
>Just expose it as an event on the user control, then call that event from within the user control, ex.
>
>In your user control:
>
>- Create a new event that mimicks the current SelectedIndexChanged event of the control
>- Create a OnSelectedIndexChanged method which will raise the event
>- Hook up the SelectedIndexChanged handler like you normally would and have it call the OnSelectedIndexChanged method.
>
>In your page which uses this user control:
>
>- Hook up the event to your new SelectedIndexChange event on the user control.
>
>
>// User Control
>public event EventHandler SelectedIndexChanged;
>
>public virtual void OnSelectedIndexChanged(object sender, EventArgs e)
>{
>    if (this.SelectedIndexChanged != null)
>        this.SelectedIndexChanged(sender, e);
>}
>
>protected void cboList_SelectedIndexChanged(object sender, EventArgs e)
>{
>    this.OnSelectedIndexChanged(sender, e);
>}
>
>
I need to study this more, it is not really simple for me now. Thanks again.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform