Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Controls (http://www.velocityreviews.com/forums/f63-asp-net-web-controls.html)
-   -   howto: bubble-up events (http://www.velocityreviews.com/forums/t776170-howto-bubble-up-events.html)

Support 05-26-2005 01:04 PM

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



Brock Allen 05-26-2005 03:39 PM

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





Support 05-26-2005 03:48 PM

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 04:18 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.