爲什麼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