Using an update panel I am attempting to perform an Async postback with a standard html button.
I have tried this:
<asp:UpdatePanel runat="server" ID="MyUpdatePanel">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnMyButton" EventName="Click" />
</Triggers>
<ContentTemplate>
<button runat="server"开发者_JAVA百科 id="btnMyButton">ASyncPostBack</button>
</ContentTemplate>
</asp:UpdatePanel>
AND
<asp:UpdatePanel runat="server" ID="MyUpdatePanel">
<Triggers>
</Triggers>
<ContentTemplate>
<button runat="server" id="btnMyButton">ASyncPostBack</button>
</ContentTemplate>
</asp:UpdatePanel>
AsyncPostBackTrigger trigger = new AsyncPostBackTrigger();
trigger.ControlID = MyControl.ID;
trigger.EventName = "Click";
MyUpdatePanel.Triggers.Add(trigger);
Judging by my scriptmanager IsInAsyncPostBack
value nether of these solutions seem to work.
I am not using a standard ASP.NET button because of issues that jQuery has with it and I am aware that I could put a hidden ASP.NET button inside the page and trigger that but am hoping for a better solution.
Event name should be EventName="onserverclick"
instead EventName="Click"
Just to update others, its now works as EventName="serverclick"
精彩评论