Hi I'm hoping someone can offer me some advise on this one please [:)]
Basically I have a simple server control that creates 4 fields as inputs and one button to submit the form. I can handle the click event of the button without any probems but I would like to have an event called GotResult.
The OnClick method stores some information in a database and then fires off an email, what I'd like to happen is that if either the db or mail fails I can set an event argument called Success to false and have some something like:
In Server Control on click event
if(itworked)
MyEventArgumentForGotResult =true;
else
MyEventArgumentForGotResult = false;
In host page
private void OnGotResult(object sender, EventArgs e)
{
if(e.Success)
//It worked
else
//It didn't
}
This is all fairly new to me and I'm stuck on the whole thing - I'm not sure where or how to declare the event or to add event arguments so I'd appreciate any advice or links to tutorials
Member
10 Points
32 Posts
Server Control Events
Sep 24, 2008 12:45 PM|ossie1971|LINK
Hi I'm hoping someone can offer me some advise on this one please [:)]
Basically I have a simple server control that creates 4 fields as inputs and one button to submit the form. I can handle the click event of the button without any probems but I would like to have an event called GotResult.
The OnClick method stores some information in a database and then fires off an email, what I'd like to happen is that if either the db or mail fails I can set an event argument called Success to false and have some something like:
In Server Control on click event
if(itworked)
MyEventArgumentForGotResult =true;
else
MyEventArgumentForGotResult = false;
In host page
private void OnGotResult(object sender, EventArgs e)
{
if(e.Success)
//It worked
else
//It didn't
}
This is all fairly new to me and I'm stuck on the whole thing - I'm not sure where or how to declare the event or to add event arguments so I'd appreciate any advice or links to tutorials
Many thanks
ossie
Contributor
6434 Points
1436 Posts
Re: Server Control Events
Sep 24, 2008 02:07 PM|nvanhaaster@resultstel.com|LINK
You can use a try {} cach{} statement for this like below
My .Net Blog
My Links are shrunk by t-ny.co
Contributor
2244 Points
862 Posts
Re: Server Control Events
Sep 27, 2008 06:56 PM|jkirkerx|LINK
Just catch the error.
Try
Catch ex As Exception
End Try