Forcing page_load from Javascript

jackychangx

New Member
Hi,<BR><BR> I'm trying to force a Page_Load from a client javascript :<BR> function refreshWindow() {<BR> alert("in refresh");<BR> __doPostBack("TimeLabel","");<BR> }<BR><BR><BR> TimeLabel is the name of a button on the page. The script fails with "... expecting object". Can someone tell me what's wrong? I also tried using single quotes, that didn't work either.<BR><BR>Thanks,<BR>Deanna<BR>(html below)<BR><BR>Page_Load:<BR>TimeLabel.Text = Now<BR><BR>HTML:<BR><BR><%@ Page Language="vb" AutoEventWireup="false"<BR><BR>Codebehind="WebForm8.aspx.vb" Inherits="tkt.WebForm8"%><BR><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><BR><HTML><BR> <HEAD><BR> <title></title><BR> <meta name="GENERATOR" content="Microsoft Visual<BR><BR>Studio.NET 7.0"><BR> <meta name="CODE_LANGUAGE" content="Visual Basic 7.0"><BR> <meta name="vs_defaultClientScript" content="JavaScript"><BR> <meta name="vs_targetSchema"<BR>content="http://schemas.microsoft.com/intellisense/ie5"><BR> <script><BR> function window_onload() {<BR> alert("in onload");<BR> window.setInterval("refreshWindow()", 5000);<BR> }<BR> function refreshWindow() {<BR> alert("in refresh");<BR> __doPostBack("TimeLabel","");<BR> }<BR> </script><BR> </HEAD><BR> <body MS_POSITIONING="GridLayout" onload="return<BR><BR>window_onload();"><BR> <form id="Form1" method="post" runat="server"><BR> <asp:Button id="Button1" style="Z-INDEX:<BR><BR>101; LEFT: 182px; POSITION: absolute; TOP: 119px" runat="server"<BR><BR>Text="Button"></asp:Button><BR> <asp:Label id="TimeLabel" style="Z-INDEX:<BR><BR>102; LEFT: 186px; POSITION: absolute; TOP: 71px" runat="server"<BR><BR>Width="276px" Height="19px">Label</asp:Label><BR> </form><BR> </body><BR></HTML><BR><BR><BR>When it says, "expecting object" it means function. In your code that you supplied there is no function __doPostback()
 
Back
Top