Javascript update problem. ASP.net UpdatePanel -


I have some javascript which I am writing in a literal control inside UpdatePanel. I have set it to alert the current time in every 15 seconds but I always get the original time. When I use firebug, I can see that the script is updating. Is this a partial page fresh? How can I stop getting this? I've tried to stop caching to see the output cache command, to see if this was a problem, but it did not make any difference.

Here the code sample is Front End:

  & asp: ScriptManager id = "ScriptManager1" runat = "server" & gt; & Lt; / ASP: ScriptManager & gt; & Lt; Asp: UpdatePanel id = "updateSTest" runat = "server" updatemod = "always" & gt; & Lt; ContentTemplate & gt; & Lt; Script type = "text / javascript" & gt; Function encryption () {& lt; Asp: literal id = "litUpdateScript" runat = "server" /> } & Lt; / Script & gt; & Lt; / ContentTemplate & gt; & Lt; Trigger & gt; & Lt; Asp: AsyncPostBackTrigger EventName = "Tick" ControlID = "panelRefresh" /> & Lt; / Trigger & gt; & Lt; / ASP: UpdatePanel & gt; & Lt; ASP: Timer ID = "Panel Refresh" Interval = "15000" Run = "Server" & gt; & Lt; / Asp: timer & gt;  

Code Back:

  Protects the sub panel handles the panel Refresh_Tick (as the object, in the form of ByVal and as the system.AventErgues) Is refreshing Meet Lit Update Script Text = "alerts ('' and now.tostring () and '' ');" End Protected All page_load (Valiele Sender as the object, e-agent applicant in the form of the system) Me.Load Me.litUpdateScript.Text = "Alerts ('' and now.tostring () and '' ') ; " String = "initScript ();" as a slow script ScriptManager.RegisterStartupScript (updTest, updTest.GetType (), "MyScript", script, True) and sub  

This page loads right time on load, but does not change on timer refresh Although I can convert the script to firebug.

I have a guess, I was not really in fact try it but javascript and updated panels Has done a lot of work together.

I think you should try to enter the incident on the tick instead of page_load. Anything else like this:

  Protected sub panel refreshtact (send by-side as an object, e-mail as a system). Refreshes the panel. Meet Lit Update Text = "alert" ("now and now" and "');" string = "initScript ();" ScriptManager.RegisterStartupScript (this.updatePanel, typef (string), "alertscript", "alert" ('Error message'); ", true); last sub  

I said by looking at Google that there are problems with people's page_load but they got to work in other programs Let me know, worth a shot.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -