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 8 1477
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
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
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
> 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
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
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
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
> 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 > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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...
|
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
|
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...
|
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...
|
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...
|
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...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
| |