Re: ASP.NET Question
From: pitcher17 (spot_at_magma.ca)
Date: 04/12/04
- Next message: Arjen: "Multiple webusercontrols"
- Previous message: Leo: "DataGrid using a table not a DataSet"
- In reply to: Jeffrey A. Voigt: "Re: ASP.NET Question"
- Next in thread: Jeffrey A. Voigt: "Re: ASP.NET Question"
- Reply: Jeffrey A. Voigt: "Re: ASP.NET Question"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 12 Apr 2004 16:38:23 -0400
That's great. I can follow everything that you're doing here except for the
line
"RegisterStatupScript("autoPostBack", scriptBlock.ToString() );"
What is this doing? Is this a function name of yours or something that has
special meaning in ASP.Net?
Pitcher
"Jeffrey A. Voigt" <voigt.jeffrey@myfloridahouse.com> wrote in message
news:OcQYnwLIEHA.2676@TK2MSFTNGP10.phx.gbl...
> We have something similar on our site. check out
> www.myfloridahouse.com/session_live_preview.aspx. We have to update
> information to the user every 60 seconds so the user knows if the House is
> dicussing another bill and/or amendment. We achived this by setting an
> autopost back every 60 seconds with the following code:
>
> private void RegisterRefreshScript()
> {
> // register a script to auto post back every so many seconds
> // NOTE: Setting a meta tag to refresh will not do a (POST BACK)
> int refreshRate =
>
Convert.ToInt32(ConfigurationSettings.AppSettings["SessionLiveRefreshRate"])
> ;
> StringBuilder scriptBlock = new StringBuilder();
> scriptBlock.Append( "<script>" );
> scriptBlock.Append( "function sessionLive_autoPostBack() ");
> scriptBlock.Append( "{ " );
> scriptBlock.Append( " __doPostBack('lnkPostBack','');");
> scriptBlock.Append( "} " );
> scriptBlock.Append( "window.setInterval( 'sessionLive_autoPostBack()',
");
> scriptBlock.Append( refreshRate.ToString() );
> scriptBlock.Append( "); ");
> scriptBlock.Append( "</script>" );
> RegisterStartupScript( "autoPostBack", scriptBlock.ToString() );
> }
>
> If you call this function each time there is a postback, you can be
assurred
> that the brower will post back to the server every so many seconds. Don't
> let this confuse you, the lnkPostBack is just a server side link button
> declare on the ASPX page like so:
>
> <asp:LinkButton ID="lnkPostBack" Runat="server"></asp:LinkButton>
>
> What is nice is that that when the post back happens it will call the
> lnkPostBack_Click event (so long as you have an event for it set up) so
you
> know the difference between the user clicking the refresh button, other
> buttons that may cause a post back, and the registered script block that
was
> added.
>
> Let me know if this helps you out!
>
> Thanks,
>
>
> "Shreyash Patel" <anonymous@discussions.microsoft.com> wrote in message
> news:0B7328D7-3170-46CB-851F-735395CED403@microsoft.com...
> > How do I make PostBack Call from the Server so that I can update
something
> on the client web browser? The Client just has the page open theres is no
> event from the Client. But I want to push something from the server so
that
> the client webpage reloads with the new information. Code Sample Please?
> >
> > Shreyash
>
>
- Next message: Arjen: "Multiple webusercontrols"
- Previous message: Leo: "DataGrid using a table not a DataSet"
- In reply to: Jeffrey A. Voigt: "Re: ASP.NET Question"
- Next in thread: Jeffrey A. Voigt: "Re: ASP.NET Question"
- Reply: Jeffrey A. Voigt: "Re: ASP.NET Question"
- Messages sorted by: [ date ] [ thread ]