Refreshing Page through CodeBehind --- Is it possible?

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

  1. #1

    Default Re: Refreshing Page through CodeBehind --- Is it possible?

    Temp wrote:
    >Can anyone tell me if it is possible to refresh the client's browser from
    >the Codebehind?
    >
    >If so, how can it be done?
    >
    >If not, does anyone have any suggestions as to how I can trick the browser
    >to refresh when a timer has been disposed of?
    >
    >Thanks
    >
    >
    >
    I presume that you mean some app running on the server? There isn't a
    way to do this server side once the page has been dispatched back to the
    browser but you could try client side javascript to poll a status page
    periodically to see if whatever work is running has been done.

    Kev



    Kevin Kenny Guest

  2. Similar Questions and Discussions

    1. refreshing page...
      I have page that is opened in a small window and after a user submits the form on that page I want the window to close and then refresh the page...
    2. Refreshing a Page
      I have a menu that calls a specific asp page and passes a variable data1page.asp?year=2001 where the value of the year variable is determined...
    3. automtically refreshing a page
      Greetings I found this in the DWMX help but unfortunately it doesn't actually say how to do it: Setting Refresh properties Use the Refresh...
    4. Web Page Refreshing...
      I was just wondering... Our company must use a web site for order information from one of our customers. They place an order on the web site and...
    5. Refreshing the page
      I was wondering if there is any way through for instance getURL(), to refresh the current page? (Like the page the SWF is currently included on.)...
  3. #2

    Default Re: Refreshing Page through CodeBehind --- Is it possible?

    "Temp" <tempmail@temp.com> wrote
    > Can anyone tell me if it is possible to refresh the client's browser from
    > the Codebehind?
    >
    Sure, just output a refresh meta tag:
    <meta http-equiv="refresh" content="10">

    e.g.
    Add an ID and RunAt attribute on the HEAD tag

    <HEAD id="head1" runat="server">
    <title>WebForm1</title>
    <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
    <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
    <meta name="vs_defaultClientScript" content="JavaScript">
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
    </HEAD>

    Then in your code-behind, and the following class level member:

    Protected WithEvents Head1 As System.Web.UI.HtmlControls.HtmlGenericControl

    Then in your Page_Load event hander, do the following:

    Head1.InnerHtml += "<meta http-equiv='refresh' content='10'>"

    --

    Thanks,
    Carl Prothman
    Microsoft ASP.NET MVP
    [url]http://www.able-consulting.com[/url]




    Carl Prothman [MVP] Guest

  4. #3

    Default Re: Refreshing Page through CodeBehind --- Is it possible?

    | <HEAD id="head1" runat="server">
    | <title>WebForm1</title>
    | <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
    | <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
    | <meta name="vs_defaultClientScript" content="JavaScript">
    | <meta name="vs_targetSchema"
    content="http://schemas.microsoft.com/intellisense/ie5">
    | </HEAD>

    As it probably would work, better solution is (AFAIK) simply add the HTTP
    header directly, instead of mimicking it in HTML:

    Response.AddHeader("refresh", "n")

    or

    Response.AddHeader("refresh", "n; url=address")

    "n" is time in seconds, "address" is address you want redirect to.

    --
    Michal A. Valasek, Altair Communications, [url]http://www.altaircom.net[/url]
    Please do not reply to this e-mail, for contact see [url]http://www.rider.cz[/url]
    Keeping Freedom safe from Democracy


    Michal A. Valasek 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