How to send output to browser and stop execution of events occuring after load

Discussion in 'ASP .Net' started by TS, Jan 20, 2006.

  1. TS

    TS Guest

    when i try to do a response.flush and .end, the screen ends up blank. I want
    all page processing to quit when a check in the pageload event fails. Since
    control events occur after load, how do i keep those from firing while still
    displaying the rest of the html on the page?
    TS, Jan 20, 2006
    #1
    1. Advertising

  2. TS

    KJ Guest

    To accomplish this, override RenderChildren() in the Page, and only
    call base.RenderChildren() when you want the other controls to load
    (when your check does not fail).

    Also, if the controls you mention are web user controls (ascx), you can
    override Render() and only call base.Render() in a similar manner.
    KJ, Jan 20, 2006
    #2
    1. Advertising

  3. Hi TS,

    Regarding on the problem you mentioned, it is limited by the ASP.NET page's
    serverside processing model, the page object will pass a series of events
    to complete its serverside processing, and the rendering is the last step.
    though we can provide a funciton to manually call class's Render method ,
    but that's not recommended and is not guaranteed to work since there may
    have some status not set correctly before the normal Render events
    happen.... So I think the recommended means is as below:

    Define a property or field in your page class to mark the flag of success
    or failure, we can set that flag in page's load or init function .....

    For our postback event handlers, we encapsulate the event handler's code
    into a separate function and call that function only when the flag match
    the expected value ....... This can prevent us from violating the ASP.NET
    page's natural model...

    Regards,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
    --------------------
    | From: "KJ" <>
    | Newsgroups: microsoft.public.dotnet.framework.aspnet
    | Subject: Re: How to send output to browser and stop execution of events
    occuring after load
    | Date: 20 Jan 2006 11:21:47 -0800
    | Organization: http://groups.google.com
    | Lines: 7
    | Message-ID: <>
    | References: <>
    | NNTP-Posting-Host: 69.32.176.2
    | Mime-Version: 1.0
    | Content-Type: text/plain; charset="iso-8859-1"
    | X-Trace: posting.google.com 1137784929 25698 127.0.0.1 (20 Jan 2006
    19:22:09 GMT)
    | X-Complaints-To:
    | NNTP-Posting-Date: Fri, 20 Jan 2006 19:22:09 +0000 (UTC)
    | In-Reply-To: <>
    | User-Agent: G2/0.2
    | X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
    rv:1.7.8) Gecko/20050511 Firefox/1.0.4,gzip(gfe),gzip(gfe)
    | Complaints-To:
    | Injection-Info: f14g2000cwb.googlegroups.com; posting-host=69.32.176.2;
    | posting-account=-EvJ3wsAAABogc-QthV-9_6Q4JSAQJuo
    | Path:
    TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onli
    ne.de!border2.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.gigan
    ews.com!postnews.google.com!f14g2000cwb.googlegroups.com!not-for-mail
    | Xref: TK2MSFTNGXA02.phx.gbl
    microsoft.public.dotnet.framework.aspnet:372505
    | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    |
    | To accomplish this, override RenderChildren() in the Page, and only
    | call base.RenderChildren() when you want the other controls to load
    | (when your check does not fail).
    |
    | Also, if the controls you mention are web user controls (ascx), you can
    | override Render() and only call base.Render() in a similar manner.
    |
    |
    Steven Cheng[MSFT], Jan 23, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Birtle
    Replies:
    2
    Views:
    2,013
    John Saunders
    Oct 16, 2003
  2. Jack Wright
    Replies:
    2
    Views:
    6,912
    yeswanthi
    May 28, 2007
  3. =?Utf-8?B?TmlzaGVldGggS2F1c2hhbA==?=

    Error occuring when i execute Fire method of BaseEvent Class

    =?Utf-8?B?TmlzaGVldGggS2F1c2hhbA==?=, Dec 7, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    406
    =?Utf-8?B?TmlzaGVldGggS2F1c2hhbA==?=
    Dec 7, 2004
  4. Mossman
    Replies:
    1
    Views:
    520
    cbDevelopment
    Dec 12, 2005
  5. Martin

    Stop some events from occuring in treeview control

    Martin, Jun 19, 2004, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    592
    ranjeet_techie
    Jan 3, 2005
Loading...

Share This Page