Maxim Gershkovich
Maxim Gershkovich

Reputation: 47149

Asyncpostback using standard button

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" 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.

Upvotes: 0

Views: 1737

Answers (2)

Naveh
Naveh

Reputation: 81

Just to update others, its now works as EventName="serverclick"

Upvotes: 1

Muhammad Akhtar
Muhammad Akhtar

Reputation: 52241

Event name should be EventName="onserverclick" instead EventName="Click"

Upvotes: 1

Related Questions