catching exceptions from web user controls

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Re: catching exceptions from web user controls

    You need to handle the Error event of the page.

    "noname" <abe.at.dont.include.this.virpack.com> wrote in message
    news:O3B2BYWRDHA.3132@tk2msftngp13.phx.gbl...
    > i want to be able to throw an exception in my web user control and catch
    it
    > in the containing page. i've tried overloading some of the page methods
    to
    > no avail. here's the stack trace:
    >
    > .
    > .
    > .
    > ANameSpace.FooClass.Page_Load(Object sender, EventArgs e) in
    foo.ascx.cs:64
    > System.Web.UI.Control.OnLoad(EventArgs e) +67
    > System.Web.UI.Control.LoadRecursive() +29
    > System.Web.UI.Control.LoadRecursive() +92
    > System.Web.UI.Control.LoadRecursive() +92
    > System.Web.UI.Page.ProcessRequestMain() +724
    >
    > as far as i can tell, the only place i could inject some try-catch code
    into
    > the page is at Page.ProcessRequestMain() ... but i can't seem to override
    > ProcessRequestMain.
    >
    > any help?
    >
    > thanks a ton.
    >
    >

    Marina Guest

  2. Similar Questions and Discussions

    1. Why the properties of web user controls which inherted from my custom base UI controls MISSED?
      Why the properties of web user controls which inherted from my custom base UI controls MISSED? How should I to set enable?
    2. using javascript in User controls to access server controls of the user control
      Hello all, I have an asp.net textbox (named txtHidden) and an HtmlButton(named btnAction). I wanted to write a javascript function which will get...
    3. user controls: dynamiclly added child controls dont survive post back ?
      hi, i have some strange behaviour: i've created a web user control that add's some child controls (e.g: textbox, image buttons) to its control...
    4. Catching thread exceptions
      This is a multi-part message in MIME format. ------=_NextPart_000_00DF_01C35DA8.55D95060 Content-Type: text/plain; charset="iso-8859-1"...
    5. Catching events in web form fired by user control
      I'm trying to process an event raised by a user control in the web form that contains that control. I've fathomed out how to handle the event...
  3. #2

    Default Re: catching exceptions from web user controls

    thanks for your help. would you mind posting an example? i tried doing
    this once but couldn't get it to compile.

    thanks again!

    "Marina" <zlatkinam@nospam.hotmail.com> wrote in message
    news:#lWLRZWRDHA.2148@TK2MSFTNGP10.phx.gbl...
    > You need to handle the Error event of the page.
    >
    > "noname" <abe.at.dont.include.this.virpack.com> wrote in message
    > news:O3B2BYWRDHA.3132@tk2msftngp13.phx.gbl...
    > > i want to be able to throw an exception in my web user control and catch
    > it
    > > in the containing page. i've tried overloading some of the page methods
    > to
    > > no avail. here's the stack trace:
    > >
    > > .
    > > .
    > > .
    > > ANameSpace.FooClass.Page_Load(Object sender, EventArgs e) in
    > foo.ascx.cs:64
    > > System.Web.UI.Control.OnLoad(EventArgs e) +67
    > > System.Web.UI.Control.LoadRecursive() +29
    > > System.Web.UI.Control.LoadRecursive() +92
    > > System.Web.UI.Control.LoadRecursive() +92
    > > System.Web.UI.Page.ProcessRequestMain() +724
    > >
    > > as far as i can tell, the only place i could inject some try-catch code
    > into
    > > the page is at Page.ProcessRequestMain() ... but i can't seem to
    override
    > > ProcessRequestMain.
    > >
    > > any help?
    > >
    > > thanks a ton.
    > >
    > >
    >
    >

    noname Guest

  4. #3

    Default Re: catching exceptions from web user controls

    It's the same way you handle the load event. Just look at what is generated,
    and change it to be for the Error event. Also, there are many examples of
    this on the web.

    "noname" <abe.at.dont.include.this.virpack.com> wrote in message
    news:%23iTeDgWRDHA.2676@TK2MSFTNGP10.phx.gbl...
    > thanks for your help. would you mind posting an example? i tried doing
    > this once but couldn't get it to compile.
    >
    > thanks again!
    >
    > "Marina" <zlatkinam@nospam.hotmail.com> wrote in message
    > news:#lWLRZWRDHA.2148@TK2MSFTNGP10.phx.gbl...
    > > You need to handle the Error event of the page.
    > >
    > > "noname" <abe.at.dont.include.this.virpack.com> wrote in message
    > > news:O3B2BYWRDHA.3132@tk2msftngp13.phx.gbl...
    > > > i want to be able to throw an exception in my web user control and
    catch
    > > it
    > > > in the containing page. i've tried overloading some of the page
    methods
    > > to
    > > > no avail. here's the stack trace:
    > > >
    > > > .
    > > > .
    > > > .
    > > > ANameSpace.FooClass.Page_Load(Object sender, EventArgs e) in
    > > foo.ascx.cs:64
    > > > System.Web.UI.Control.OnLoad(EventArgs e) +67
    > > > System.Web.UI.Control.LoadRecursive() +29
    > > > System.Web.UI.Control.LoadRecursive() +92
    > > > System.Web.UI.Control.LoadRecursive() +92
    > > > System.Web.UI.Page.ProcessRequestMain() +724
    > > >
    > > > as far as i can tell, the only place i could inject some try-catch
    code
    > > into
    > > > the page is at Page.ProcessRequestMain() ... but i can't seem to
    > override
    > > > ProcessRequestMain.
    > > >
    > > > any help?
    > > >
    > > > thanks a ton.
    > > >
    > > >
    > >
    > >
    >
    >

    Marina Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139