我有以下内容,如果您单击任一.net按钮,更新面板将刷新。但无论我做什么,我似乎无法使用onclick事件让面板刷新。如果单击“html按钮”,整个页面将刷新。
<script type="text/javascript">
var UpdatePanel1 = '<%=UpdatePanel1.ClientID%>';
function fireButton() {
//__doPostBack(UpdatePanel1, '');
$('#<%=Button2.ClientID%>').submit();
}
</script>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" />
<asp:AsyncPostBackTrigger ControlID="Button3" />
</Triggers>
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<%=DateTime.Now.ToString() %>
<br />
<asp:Button ID="Button2"
Text="Refresh Panel"
runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
<p><%=DateTime.Now.ToString() %></p>
<asp:Button ID="Button3" runat="server" Text="other refresh button" />
<button onclick="fireButton()">html button</button>
有谁能告诉我我做错了什么?
感谢
答案 0 :(得分:0)
你的javascript看起来不正确。试试这个:
Sys.WebForms.PageRequestManager.getInstance().beginAsyncPostBack(new Array('updatePanelId'));