473,569 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Urgent User Control

Hi All,

I have a requirement. I am throwing an exception from my user control I want
to catch this in my container page. Is this possible?

I don't want any event to be raised.

PLEASE HELP ME.

Thanks

Prince
Nov 19 '05 #1
8 1490
Here's how exceptions work. When a function calls another function that
calls another function that raises an exception, the final function raises
the exception. If the exception is not handled by that function, it will
cause the exception to "bubble up" to the function that called the function
that raised the exception. This will happen until either (1) the exception
is handled at some point in the chain, or (2) the application thread is
aborted due to an unhandled exception.

Knowing this, of course, your solution is obvious.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"Prince Mathew" <pr************ ****@hotmail.co m> wrote in message
news:O9******** ******@TK2MSFTN GP15.phx.gbl...
Hi All,

I have a requirement. I am throwing an exception from my user control I
want to catch this in my container page. Is this possible?

I don't want any event to be raised.

PLEASE HELP ME.

Thanks

Prince

Nov 19 '05 #2
Kevin,

I know how exception handling works. But my question is how will you catch
an exception thrown from the User Control. Say you are throwing an exception
from the Page_Load of the user control.Where will you put the try catch in
the container page.

Thanks
Prince

"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:u9******** ******@TK2MSFTN GP15.phx.gbl...
Here's how exceptions work. When a function calls another function that
calls another function that raises an exception, the final function raises
the exception. If the exception is not handled by that function, it will
cause the exception to "bubble up" to the function that called the
function that raised the exception. This will happen until either (1) the
exception is handled at some point in the chain, or (2) the application
thread is aborted due to an unhandled exception.

Knowing this, of course, your solution is obvious.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
What You Seek Is What You Get.

"Prince Mathew" <pr************ ****@hotmail.co m> wrote in message
news:O9******** ******@TK2MSFTN GP15.phx.gbl...
Hi All,

I have a requirement. I am throwing an exception from my user control I
want to catch this in my container page. Is this possible?

I don't want any event to be raised.

PLEASE HELP ME.

Thanks

Prince


Nov 19 '05 #3
If you don't want to bubble up an event in the UserControl, your best option is to catch the error in Page_Load event. Alternatively, you can load the control at runtime(dynamic ally) and catch the exception in that method.

Thanks,
Prodip
www.aspnet4you.com
"Prince Mathew" <pr************ ****@hotmail.co m> wrote in message news:u3******** *****@TK2MSFTNG P10.phx.gbl...
Kevin,

I know how exception handling works. But my question is how will you catch
an exception thrown from the User Control. Say you are throwing an exception
from the Page_Load of the user control.Where will you put the try catch in
the container page.

Thanks
Prince

"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:u9******** ******@TK2MSFTN GP15.phx.gbl...
Here's how exceptions work. When a function calls another function that
calls another function that raises an exception, the final function raises
the exception. If the exception is not handled by that function, it will
cause the exception to "bubble up" to the function that called the
function that raised the exception. This will happen until either (1) the
exception is handled at some point in the chain, or (2) the application
thread is aborted due to an unhandled exception.

Knowing this, of course, your solution is obvious.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
What You Seek Is What You Get.

"Prince Mathew" <pr************ ****@hotmail.co m> wrote in message
news:O9******** ******@TK2MSFTN GP15.phx.gbl...
Hi All,

I have a requirement. I am throwing an exception from my user control I
want to catch this in my container page. Is this possible?

I don't want any event to be raised.

PLEASE HELP ME.

Thanks

Prince




Nov 19 '05 #4
> I know how exception handling works. But my question is how will you catch
an exception thrown from the User Control.
Classes don't throw exceptions. Functions do.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"Prince Mathew" <pr************ ****@hotmail.co m> wrote in message
news:u3******** *****@TK2MSFTNG P10.phx.gbl... Kevin,

I know how exception handling works. But my question is how will you catch
an exception thrown from the User Control. Say you are throwing an
exception from the Page_Load of the user control.Where will you put the
try catch in the container page.

Thanks
Prince

"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:u9******** ******@TK2MSFTN GP15.phx.gbl...
Here's how exceptions work. When a function calls another function that
calls another function that raises an exception, the final function
raises the exception. If the exception is not handled by that function,
it will cause the exception to "bubble up" to the function that called
the function that raised the exception. This will happen until either (1)
the exception is handled at some point in the chain, or (2) the
application thread is aborted due to an unhandled exception.

Knowing this, of course, your solution is obvious.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
What You Seek Is What You Get.

"Prince Mathew" <pr************ ****@hotmail.co m> wrote in message
news:O9******** ******@TK2MSFTN GP15.phx.gbl...
Hi All,

I have a requirement. I am throwing an exception from my user control I
want to catch this in my container page. Is this possible?

I don't want any event to be raised.

PLEASE HELP ME.

Thanks

Prince



Nov 19 '05 #5
Kevin,
Can you answer my question? Or are you still not clear about the question???

"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:Oy******** ******@TK2MSFTN GP15.phx.gbl...
I know how exception handling works. But my question is how will you
catch an exception thrown from the User Control.


Classes don't throw exceptions. Functions do.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
What You Seek Is What You Get.

"Prince Mathew" <pr************ ****@hotmail.co m> wrote in message
news:u3******** *****@TK2MSFTNG P10.phx.gbl...
Kevin,

I know how exception handling works. But my question is how will you
catch an exception thrown from the User Control. Say you are throwing an
exception from the Page_Load of the user control.Where will you put the
try catch in the container page.

Thanks
Prince

"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:u9******** ******@TK2MSFTN GP15.phx.gbl...
Here's how exceptions work. When a function calls another function that
calls another function that raises an exception, the final function
raises the exception. If the exception is not handled by that function,
it will cause the exception to "bubble up" to the function that called
the function that raised the exception. This will happen until either
(1) the exception is handled at some point in the chain, or (2) the
application thread is aborted due to an unhandled exception.

Knowing this, of course, your solution is obvious.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
What You Seek Is What You Get.

"Prince Mathew" <pr************ ****@hotmail.co m> wrote in message
news:O9******** ******@TK2MSFTN GP15.phx.gbl...
Hi All,

I have a requirement. I am throwing an exception from my user control I
want to catch this in my container page. Is this possible?

I don't want any event to be raised.

PLEASE HELP ME.

Thanks

Prince



Nov 19 '05 #6
Prodip,

Have you tried what you have said ????. Page_Load of the user control is executed after the Page_Load of the Page.

Thanks
Prince
"Prodip Saha" <ps***@bear.com > wrote in message news:ee******** ******@tk2msftn gp13.phx.gbl...
If you don't want to bubble up an event in the UserControl, your best option is to catch the error in Page_Load event. Alternatively, you can load the control at runtime(dynamic ally) and catch the exception in that method.

Thanks,
Prodip
www.aspnet4you.com
"Prince Mathew" <pr************ ****@hotmail.co m> wrote in message news:u3******** *****@TK2MSFTNG P10.phx.gbl...
Kevin,

I know how exception handling works. But my question is how will you catch
an exception thrown from the User Control. Say you are throwing an exception
from the Page_Load of the user control.Where will you put the try catch in
the container page.

Thanks
Prince

"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:u9******** ******@TK2MSFTN GP15.phx.gbl...
Here's how exceptions work. When a function calls another function that
calls another function that raises an exception, the final function raises
the exception. If the exception is not handled by that function, it will
cause the exception to "bubble up" to the function that called the
function that raised the exception. This will happen until either (1) the
exception is handled at some point in the chain, or (2) the application
thread is aborted due to an unhandled exception.

Knowing this, of course, your solution is obvious.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
What You Seek Is What You Get.

"Prince Mathew" <pr************ ****@hotmail.co m> wrote in message
news:O9******** ******@TK2MSFTN GP15.phx.gbl...
Hi All,

I have a requirement. I am throwing an exception from my user control I
want to catch this in my container page. Is this possible?

I don't want any event to be raised.

PLEASE HELP ME.

Thanks

Prince




Nov 19 '05 #7
Sorry. Prince, you are correct. Page_load event would not be able to catch the exception. I experienced the problem and handled the exception within the UserControl itself. Have you tried to catch the exception in -OnInit method? This is first in the line of Control Execution Lifecycle. I did not try but you may want to give it a try.

However, if you dynamically load the control (why not) you would have much better control over the exception handling. In this case, there would not be any need to register a tagprefix, etc.

Thanks,
Prodip
www.aspnet4you.com

"Prince Mathew" <pr************ ****@hotmail.co m> wrote in message news:eC******** ******@TK2MSFTN GP12.phx.gbl...
Prodip,

Have you tried what you have said ????. Page_Load of the user control is executed after the Page_Load of the Page.

Thanks
Prince
"Prodip Saha" <ps***@bear.com > wrote in message news:ee******** ******@tk2msftn gp13.phx.gbl...
If you don't want to bubble up an event in the UserControl, your best option is to catch the error in Page_Load event. Alternatively, you can load the control at runtime(dynamic ally) and catch the exception in that method.

Thanks,
Prodip
www.aspnet4you.com
"Prince Mathew" <pr************ ****@hotmail.co m> wrote in message news:u3******** *****@TK2MSFTNG P10.phx.gbl...
Kevin,

I know how exception handling works. But my question is how will you catch
an exception thrown from the User Control. Say you are throwing an exception
from the Page_Load of the user control.Where will you put the try catch in
the container page.

Thanks
Prince

"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:u9******** ******@TK2MSFTN GP15.phx.gbl...
Here's how exceptions work. When a function calls another function that
calls another function that raises an exception, the final function raises
the exception. If the exception is not handled by that function, it will
cause the exception to "bubble up" to the function that called the
function that raised the exception. This will happen until either (1) the
exception is handled at some point in the chain, or (2) the application
thread is aborted due to an unhandled exception.

Knowing this, of course, your solution is obvious.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
What You Seek Is What You Get.

"Prince Mathew" <pr************ ****@hotmail.co m> wrote in message
news:O9******** ******@TK2MSFTN GP15.phx.gbl...
Hi All,

I have a requirement. I am throwing an exception from my user control I
want to catch this in my container page. Is this possible?

I don't want any event to be raised.

PLEASE HELP ME.

Thanks

Prince




Nov 19 '05 #8
> Kevin,
Can you answer my question? Or are you still not clear about the
question???
I DID answer it:
Here's how exceptions work. When a function calls another function that
calls another function that raises an exception, the final function
raises the exception. If the exception is not handled by that function,
it will cause the exception to "bubble up" to the function that called
the function that raised the exception. This will happen until either
(1) the exception is handled at some point in the chain, or (2) the
application thread is aborted due to an unhandled exception.

Knowing this, of course, your solution is obvious.

If you want me to spell it out for you, you put a try/catch in whatever
function in the chain that you want to handle the exception. Functions are
called by other functions.

For example, low-level classes generally throw exceptions rather than
catching or handling them. Higher level applications use these classes, and
functions that use them should handle any exceptions thrown by functions in
the low-level classes. Since I don't know the hierarchy in your code, or how
it is designed, I can't tell you specifically in what function to handle the
exception in, or specifically how to handle it.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"Prince Mathew" <pr************ ****@hotmail.co m> wrote in message
news:eU******** ******@TK2MSFTN GP12.phx.gbl... Kevin,
Can you answer my question? Or are you still not clear about the
question???

"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:Oy******** ******@TK2MSFTN GP15.phx.gbl... I know how exception handling works. But my question is how will you
catch an exception thrown from the User Control.


Classes don't throw exceptions. Functions do.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
What You Seek Is What You Get.

"Prince Mathew" <pr************ ****@hotmail.co m> wrote in message
news:u3******** *****@TK2MSFTNG P10.phx.gbl...
Kevin,

I know how exception handling works. But my question is how will you
catch an exception thrown from the User Control. Say you are throwing an
exception from the Page_Load of the user control.Where will you put the
try catch in the container page.

Thanks
Prince

"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:u9******** ******@TK2MSFTN GP15.phx.gbl...
Here's how exceptions work. When a function calls another function that
calls another function that raises an exception, the final function
raises the exception. If the exception is not handled by that function,
it will cause the exception to "bubble up" to the function that called
the function that raised the exception. This will happen until either
(1) the exception is handled at some point in the chain, or (2) the
application thread is aborted due to an unhandled exception.

Knowing this, of course, your solution is obvious.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
What You Seek Is What You Get.

"Prince Mathew" <pr************ ****@hotmail.co m> wrote in message
news:O9******** ******@TK2MSFTN GP15.phx.gbl...
> Hi All,
>
>
>
> I have a requirement. I am throwing an exception from my user control
> I want to catch this in my container page. Is this possible?
>
> I don't want any event to be raised.
>
> PLEASE HELP ME.
>
>
>
> Thanks
>
> Prince
>
>



Nov 19 '05 #9

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

Similar topics

8
5220
by: Mike | last post by:
Hello, I have a few rather urgent questions that I hope someone can help with (I need to figure this out prior to a meeting tomorrow.) First, a bit of background: The company I work for is developing a web-based application, one part of which involves allowing the user the ability to page through transaction "history" information. The...
4
4275
by: John | last post by:
Hi all, This really is quite an urgent matter. I have a page with multiple, dynamically-loaded user controls and when a user clicks on a button, the whole form is submitted. Now at this stage I know I need to call a function that will save data but I'm not sure exactly when to call this function. I've tried two ways and both seem to...
9
2165
by: Moe Sizlak | last post by:
Hi There, I am trying to write the selected value of a listcontrol when a button is clicked and I keep getting the error "object not set to a reference of an object". The libox itself is in a usercontrol and all i'm really needing to do is get the selected value when the button is clicked on the form. Can someone tell what I need to...
5
1503
by: Dan Nash | last post by:
Hi all, I've got a page with a user control on, added via VS. I'm trying to get to a property of the user control (or more precisely, a public var). Here's the code at the top of my aspx page... <%@ Register TagPrefix="dI2" TagName="dartsUC_rolodexsearch" Src="dartsUC_rolodexsearch.ascx" %>
6
1976
by: Anonymous | last post by:
Hello, I am loading a usercontrol with the LoadControl method and need to pass some data to the property of that control. How can I do that? THanks
8
1816
by: Tim::.. | last post by:
Can someone please tell me why I keep getting the following error for some of my web application users but not others??? Even though the application runs from a central webserver??? Thanks for any help... Error: -----
7
13619
by: deepagulati | last post by:
Hi, I need an urgent help from you. When we dynamically genrate any list box (Select Box) it shows one default value as selected. Is there any way that we can deselect that value. I tried with document.form_Name.ListBox_Name.options.selected =
0
1051
by: =?Utf-8?B?R2lvcmdpbw==?= | last post by:
Hi, I need some urgent help and your help is very much appreciated. I have a control in a directory named components and I am trying to load that control and add it to the page and when I run the web site locally it's ok but when I try to publish the web site then I get the following error: Error 1 Type 'ASP.components_jobs_ascx' is not...
2
2368
by: itsvineeth209 | last post by:
My task is to create login control without using login control in tools. I shouldnt use sqldatasource or any other. I should use only data sets, data adapters and data readers etc. U had created table login with fields username(varchar(50)), password(varchar(50)), firstname(varchar(50)), lastname(varchar(50)). U had to display username , first...
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6287
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5223
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3657
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2117
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1228
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
946
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.