Home All Groups Group Topic Archive Search About
Author
26 May 2005 1:04 PM
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

Author
26 May 2005 3:39 PM
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.

-Brock
DevelopMentor
http://staff.develop.com/ballen



Show quoteHide quote
> 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
Author
26 May 2005 3:48 PM
Support
thanks - i have to understand the c syntax ...
Terry
Show quoteHide quote
"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
>
>
>