![]() |
howto: bubble-up events
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 |
Re: howto: bubble-up events
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. -Brock DevelopMentor http://staff.develop.com/ballen > 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 |
Re: howto: bubble-up events
thanks - i have to understand the c syntax ...
Terry "Brock Allen" <ballen@NOSPAMdevelop.com> wrote in message news:810893632527043445866176@msnews.microsoft.com ... > 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. > > -Brock > DevelopMentor > http://staff.develop.com/ballen > > > >> 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 > > > |
| All times are GMT. The time now is 02:47 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.