howto: bubble-up events

S

Support

Hello:
using Vb.net ..
I have an asp.net web page: home.aspx, with a placeholder that loads
Inspections.ascx
UserCategories.aspx has a button MySubmit that submits information:
what I want is some code that I would place in home.aspx that would detect
that MySubmit was clicked and get the name of the button (in this case,
MySubmit)

Is there a way to do this ?
Thanks
Terry
 
B

Brock Allen

Yep. Add an event to your usercontrol and then in the UC's click event handler
for the button, raise the event:

class MyUC
{
public event EventHandler MySubmit;

private void Button1_Click()
{
if (MySubmit != null) MySubmit(this, EventArgs.Empty);
}
}

The in the page, just handle the OnMySubmit like you'd handle any event from
any other control.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top