SIGN UP MEMBER LOGIN:    
Blog

Auto-refreshing web page using JavaScript in ASP. NET

Posted by Rohatash Kumar Blogs | ASP.NET using VB.NET Jun 30, 2011
Here, we will use JavaScript to refreshing web page automatically.

Here, we will use JavaScript to refreshing web page automatically.

Using Java Script

Add the following java script code in the head section of the page.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="Textarea_count.WebForm2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title></title>

    <script type="text/JavaScript">

   function RefreshPage(Period) {

  setTimeout("location.reload(true);", Period);

  }              

 </script>

</head>

<body>

    <form id="form1" runat="server">

    <div>

    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

    </div>

    </form>

</body>

</html>

Now Drag and drop a label control on the form and add the following code on the page load event.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Label1.Text = "TimeOfDay: " & TimeOfDay().ToString()

    End Sub

share this blog :
post comment