473,854 Members | 1,820 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 1504
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
5280
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 _summary_ history table will have the following fields: ServiceName, Date, User-Ref1, User-Ref2,...
4
4300
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 have 'gotcha's':
9
2185
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 include in my page to get this working ? Moe <><
5
1522
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
2000
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
1836
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
13641
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
1067
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 defined. C:\Projects\TPP\pages\jobs.aspx.vb 240
2
2382
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 name, last name in default.aspx page after login. One more condition is that, if user fails login...
0
9899
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11024
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10672
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10362
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9510
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5937
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4550
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
2
4149
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3182
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.