为什么JQuery功能在股票更新时不起作用更新面板?请参阅下面的代码。JQuery功能在股票更新时不起作用更新面板
<asp:Timer ID="Schedule_Timer" runat="server" Interval="10000"></asp:Timer>
<asp:UpdatePanel ID="Schedule_UpdatePanel" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Schedule_Timer" EventName="Tick" />
</Triggers>
<ContentTemplate>
<asp:Panel ID="Schedule_Panel" runat="server" Height="250px" Width="250px">
<asp:Literal ID="Schedule_Label" runat="server" Text=""></asp:Literal>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
<script>
$('#test').cycle({
fx: 'scrollUp',
timeout: 6000,
delay: -2000
});
</script>
的Schedule_Label
经由代码隐藏填充:
Protected Sub Schedule_Timer_Tick(sender As Object, e As System.EventArgs) Handles Schedule_Timer.Tick
PrintTheSchedule()
End Sub
Private Sub PrintTheSchedule()
//This is just for example, the actual data is taken from gridview based on the realtime
Schedule_Label.Text = "<div id='test'>" & _
"<div>test 1</div>" & _
"<div>test 2</div>" & _
"<div>test 3</div>" & _
"<div>"
End Sub
对于第一个10秒,JQuery的做循环所述test
DIV。但是在UpdatePanel刷新后,JQuery不再运行,并且它导致页面上显示的所有test
div值。如何解决这个问题?非常感谢你。
嗨,它的作品。但为什么前10秒JQuery不运行? 10秒后,代码适用于我.. –
@ mrjimoy_05在页面加载中,您还可以运行ScriptManager代码。因为需要在第一次运行RunScript函数或者使用Jquery Document ready加载此函数 – Moons
@ mrjimoy_05检查更新的代码 – Moons