In order to create event in your control, you should:
1. Create EventArgs class
public class CustomControlButtonPressedEventArgs
{
bool _success;
public CustomControlButtonPressedEventArgs(bool success)
{
_success = success;
}
public bool Success
{
get { return _success; }
}
}
2. Create delegate type (for event handlers)
public delegate void CustomControlButtonPressedEventHandler(object sender,
CustomControlButtonPressedEventArgs e);
3. Create event
public event CustomControlButtonPressedEventHandler
CustomControlButtonPressed;
4. Create OnEvent function for raising the event
protected virtual void
OnCustomControlButtonPressed(CustomControlButtonPr essedEventArgs e)
{
// Check if there are any handlers attached
if (CustomControlButtonPressed != null) CustomControlButtonPressed(this,
e);
}
5. Call OnCustomControlButtonPressed function when your control's button is
actually pressed.
HTH,
Andrey.
"shapper" <md*****@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
Hi,
I have no idea how to create events in my custom control.
Could you point some links to documentation or maybe an example?
Thanks,
Miguel
Andrey Korneyev wrote:
>Declare an event, which your control would raise. Handle that event in
your
ASPX form.
I hope you know how to create events in C#.
Andrey.
"shapper" <md*****@gmail.comwrote in message
news:11**********************@e3g2000cwe.googlegr oups.com...
Hi,
Yes, I know that.
But in my page how can I detect when the button is pressed so I can I
check that value?
I think I am missing something here.
Thanks,
Miguel