Sunday, March 11, 2012

Two timercontrols

hi,

i did try it & it worked fine.....are all the objects affected by the non working timer in an update panel?


The controls effected by the two subs (nemico and attacco_mio) are not inside an updatepanel.

Should i put them inside an update panel? or two separated update panel for the two controls (button and label) effected by the sub's timer.

Thanks

Fausto


you can put them in one updatepanel ...that should be enough ...still if it doesnt paste the detailed code up here

Imran Nathani


The two timers need to fire subs that interact with session variables and returns values that i put inside a textbox so the object of the timers arent controls but subs.
Im using them like i used timer controls in VB6 and VB.NET maybe that's the problem?
public sub nemico(sender As Object, e As System.EventArgs) ... results.text = stringa & results.text button1.enabled="False"...end subpublic sub attacco_mio(sender As Object, e As System.EventArgs) ... results2.text = stringa & results2.text button1.enabled="False"...end sub..."server">"ScriptManager1" runat="Server" />"server" Interval="5000" ID="timer_nemico" OnTick="nemico" />"server" Interval="10000" ID="timer_mio" OnTick="attacco_mio" />inside the html's body:"Button1" Text="Attacco" runat="server" onclick="attacco_proc" Enabled="false"/>....."results" runat="server" Width="250" TextMode="MultiLine" Rows="10" />"results2" runat="server" Width="250" TextMode="MultiLine" Rows="10" />

Thanks

Fausto


For both the timers to work together you have to use script manager with partial rendering to true. The timers are controlled by the browser and not by the server. What is happening is that the first timer causes a postback so the client side browser page is destroyed as a result the second timer never gets chance to fire its events. When you set EnablePartialRendering to true, the broswer page is not destroyed as the postback is suppressed and a callback is made to the server.

You also need to place the textboxes within an UpdatePanel as you are updating them in response to timer ticks.


Thank you, this last hint solved my problem.
Now my page is working fine.

Fausto

No comments:

Post a Comment