Ajax updatepanel +母版页 [英] Ajax updatepanel + master page
问题描述
大家好,
我正在使用asp.net中的母版页+ updatepanel +计时器控件.
在计时器控制下,我将我的标签设置为visible = false,这在一段时间后位于updatepanel内.
当使用updatepanel +计时器控件进行应用时,它可以正常工作,仅刷新updatepanel.但是当使用母版页而不是更新面板时,会刷新整个页面.
源代码
Hi all,
I am working with masterpages + updatepanel + timer control in asp.net.
On timer control i am setting my label to visible=false which is inside updatepanel after some interval of time.
When applying with updatepanel + timer control then it works properly refreshing only updatepanel. But when working with masterpages instead of update panel complete page gets refreshed.
Source Code
<asp:updatepanel id="UpdatePanel1" runat="server" updatemode="Conditional" childrenastriggers="true" xmlns:asp="#unknown">
<contenttemplate>
<asp:label id="lbl_msg" runat="server" forecolor="Red" font-bold="False" font-size="Small"></asp:label>
<asp:timer id="Timer1" runat="server" interval="5000">
</asp:timer>
</contenttemplate>
<triggers>
<asp:asyncpostbacktrigger controlid="Timer1" eventname="Tick" />
</triggers>
</asp:updatepanel>
和timer1_tick代码如下:
and timer1_tick code is as follows :
Protected Sub Timer1_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles Timer1.Tick
Dim time1 As TimeSpan = New TimeSpan
time1 = Convert.ToDateTime(Session("time")) - DateTime.Now
If time1.Seconds <= 0 Then
lbl_msg.Text = ""
Else
End If
End Sub
我的要求是仅刷新更新面板,而不刷新整个页面.
任何帮助将不胜感激
Thanx
My requirement is to only refresh only update panel instead of complete page.
Any help is greatly appreciated
Thanx
推荐答案
为什么在地球上需要所有这些来运行计时器?为什么不在客户端上全部完成呢?
Why on earth do you need all of this to run a timer ? Why not do it all on the client?
这篇关于Ajax updatepanel +母版页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!