472,789 Members | 1,323 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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 1439
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.com> wrote in message
news:O9**************@TK2MSFTNGP15.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***@DIESPAMMERSDIEtakempis.com> wrote in message
news:u9**************@TK2MSFTNGP15.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.com> wrote in message
news:O9**************@TK2MSFTNGP15.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(dynamically) and catch the exception in that method.

Thanks,
Prodip
www.aspnet4you.com
"Prince Mathew" <pr****************@hotmail.com> wrote in message news:u3*************@TK2MSFTNGP10.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***@DIESPAMMERSDIEtakempis.com> wrote in message
news:u9**************@TK2MSFTNGP15.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.com> wrote in message
news:O9**************@TK2MSFTNGP15.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.com> wrote in message
news:u3*************@TK2MSFTNGP10.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***@DIESPAMMERSDIEtakempis.com> wrote in message
news:u9**************@TK2MSFTNGP15.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.com> wrote in message
news:O9**************@TK2MSFTNGP15.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***@DIESPAMMERSDIEtakempis.com> wrote in message
news:Oy**************@TK2MSFTNGP15.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.com> wrote in message
news:u3*************@TK2MSFTNGP10.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***@DIESPAMMERSDIEtakempis.com> wrote in message
news:u9**************@TK2MSFTNGP15.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.com> wrote in message
news:O9**************@TK2MSFTNGP15.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**************@tk2msftngp13.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(dynamically) and catch the exception in that method.

Thanks,
Prodip
www.aspnet4you.com
"Prince Mathew" <pr****************@hotmail.com> wrote in message news:u3*************@TK2MSFTNGP10.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***@DIESPAMMERSDIEtakempis.com> wrote in message
news:u9**************@TK2MSFTNGP15.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.com> wrote in message
news:O9**************@TK2MSFTNGP15.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.com> wrote in message news:eC**************@TK2MSFTNGP12.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**************@tk2msftngp13.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(dynamically) and catch the exception in that method.

Thanks,
Prodip
www.aspnet4you.com
"Prince Mathew" <pr****************@hotmail.com> wrote in message news:u3*************@TK2MSFTNGP10.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***@DIESPAMMERSDIEtakempis.com> wrote in message
news:u9**************@TK2MSFTNGP15.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.com> wrote in message
news:O9**************@TK2MSFTNGP15.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.com> wrote in message
news:eU**************@TK2MSFTNGP12.phx.gbl... Kevin,
Can you answer my question? Or are you still not clear about the
question???

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:Oy**************@TK2MSFTNGP15.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.com> wrote in message
news:u3*************@TK2MSFTNGP10.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***@DIESPAMMERSDIEtakempis.com> wrote in message
news:u9**************@TK2MSFTNGP15.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.com> wrote in message
news:O9**************@TK2MSFTNGP15.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
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...
4
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...
9
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...
5
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...
6
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
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...
7
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...
0
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...
2
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...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{

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.