使用UpdatePanel的初始工作很好,但一段时间后不能正常工作 [英] Using updatepanel initial working well but after some time not working
问题描述
我把我的LinkButton中的UpdatePanel和工作正常
但是,如果我把页面打开一个小时在一起,然后点击LinkButton的,比的LinkButton的Click事件没有被调用。
如果我要调用的事件我必须刷新该网页,比它开始工作的罚款。
I am putting my linkbutton in the updatepanel and is working fine But if i put that page open for an hours together and then click that linkbutton, than the click event of that linkbutton is not called. If i want to call that event i have to refresh that page and than it start working fine.
我的.cs code(aspx.cs)该链接按钮
My .cs code(aspx.cs) for that link button is
protected void lnkcontact_Click(object sender, EventArgs e)
{
Response.Redirect("index.aspx?name=6");
}
我的设计页面code(C ++)
my design page code(aspx)
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:LinkButton CssClass="bottom-link" ID="lnkcontact" runat="server" OnClick="lnkcontact_Click">CONTACT</asp:LinkButton>
</ContentTemplate>
</asp:UpdatePanel>
有没有必要写code作为一切工作正常,唯一的问题是,
There was no need to write the code as all is working properly the only problem is that
如果我把页面打开连续无任何工作做得比为什么LinkButton的Click事件一段时间后不叫?
推荐答案
我们必须做两件事情来收集
We have to do 2 things to gather
1>按照指令为拉特纳说。
1 > Follow the instruction as Ratna said.
有关例如:
<asp:UpdatePanel ID="UpdatePanel10" runat="server">
<ContentTemplate>
<asp:Timer ID="Timer1" runat="server" Interval="180000">
</asp:Timer>
</ContentTemplate>
</asp:UpdatePanel>
2>让你想点击的UpdatePanel中的按钮异步回发
2 > Make asynchronous postback of the button you want to make click in updatepanel
有关例如:
<asp:UpdatePanel ID="UpdatePanel15" runat="server" UpdateMode="Conditional">
<ContentTemplate>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="" EventName="" />//this is asynchronouspostback
</Triggers>
</asp:UpdatePanel>
所以这个聚集形式为code作为
So this to gather form code as
<asp:UpdatePanel ID="UpdatePanel10" runat="server">
<ContentTemplate>
<asp:Timer ID="Timer1" runat="server" Interval="180000">
</asp:Timer>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel15" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Button ID="btn" runat="server" Text="Upload File" OnClick="btn_upload_file_Click" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btn" EventName="Click" />//this is asynchronouspostback
</Triggers>
</asp:UpdatePanel>
这篇关于使用UpdatePanel的初始工作很好,但一段时间后不能正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!