473,385 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Catch result

Hello,

I created a custom control where I have a few textboxes and a button
(MyButton).
When the button is clicked the textboxes data are sent to a database.

In MyButton_Click function I have a variable named Done.
If everything is went well I set this variable to True. Otherwise I set
it to false.

I placed this custom control on my page.

How can I get the value of Done in my page?

Basically, I need, in my page, to take an action according to the value
of Done after the button in the custom control is pressed.

Thanks,
Miguel

Nov 9 '06 #1
5 1009
Create a public property that will acess your local private variable

// say this was the intialization of the variable
private bool done = false;

//we would make a property like this.
public bool Done
{
get
{ return done; }
// and if you want to let the form set the done property as well,
include the set accessor
set
{ done = value; }
}
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
"shapper" <md*****@gmail.comwrote in message
news:11**********************@h54g2000cwb.googlegr oups.com...
Hello,

I created a custom control where I have a few textboxes and a button
(MyButton).
When the button is clicked the textboxes data are sent to a database.

In MyButton_Click function I have a variable named Done.
If everything is went well I set this variable to True. Otherwise I set
it to false.

I placed this custom control on my page.

How can I get the value of Done in my page?

Basically, I need, in my page, to take an action according to the value
of Done after the button in the custom control is pressed.

Thanks,
Miguel

Nov 9 '06 #2
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

Mark Fitzpatrick wrote:
Create a public property that will acess your local private variable

// say this was the intialization of the variable
private bool done = false;

//we would make a property like this.
public bool Done
{
get
{ return done; }
// and if you want to let the form set the done property as well,
include the set accessor
set
{ done = value; }
}
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
"shapper" <md*****@gmail.comwrote in message
news:11**********************@h54g2000cwb.googlegr oups.com...
Hello,

I created a custom control where I have a few textboxes and a button
(MyButton).
When the button is clicked the textboxes data are sent to a database.

In MyButton_Click function I have a variable named Done.
If everything is went well I set this variable to True. Otherwise I set
it to false.

I placed this custom control on my page.

How can I get the value of Done in my page?

Basically, I need, in my page, to take an action according to the value
of Done after the button in the custom control is pressed.

Thanks,
Miguel
Nov 9 '06 #3
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.googlegro ups.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

Nov 9 '06 #4
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.googlegro ups.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
Nov 9 '06 #5
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

Nov 9 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Khuong Dinh Pham | last post by:
How can i get more information about the exception when using catch(...)? Thx in advance
11
by: Pohihihi | last post by:
I was wondering what is the ill effect of using try catch in the code, both nested and simple big one. e.g. try { \\ whole app code goes here } catch (Exception ee) {}
13
by: Benny | last post by:
Hi, I have something like this: try { // some code } catch // note - i am catching everything now {
23
by: VB Programmer | last post by:
Variable scope doesn't make sense to me when it comes to Try Catch Finally. Example: In order to close/dispose a db connection you have to dim the connection outside of the Try Catch Finally...
20
by: Woody Splawn | last post by:
In a message yesterday titled Try Catch Question I got numerous responses. Thank you to all. After all the smoke clears I guess the question is where to place the Return True statement in the...
9
by: Bob Achgill | last post by:
I really like this function but have tried to slow down on using it because I get a 1 second pause each time I use it. I don't really understand why the computer has to think for 1 second! ...
2
by: robert | last post by:
When employing complex UI libs (wx, win32ui, ..) and other extension libs, nice "only Python stack traces" remain a myth. Currently I'm hunting again a rare C-level crash bug of a Python based...
8
by: Luke Davis | last post by:
I'm new so bear with me. Is there a way for the catch to fix a problem then start the try over again? For example, I have this console application sync a remote database and it takes hours. ...
3
by: aemado | last post by:
I am really new to the try/catch/throw concept, and can't figure out what is wrong with my code. Any suggestions? #include <iostream> using namespace std; string msgZero = "Zero...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.