Sean Anderson
Sean Anderson

Reputation: 29291

UpdatePanel Triggers, how to set trigger event for __doPostBack?

I have an UpdatePanel on my page which I would like to set up some triggers for:

<asp:updatepanel id="updatepanel1" runat="server">
     <contenttemplate>
          <asp:label id="lblfoo" runat="server />
     </contenttemplate>
     <triggers>
          <asp:asyncpostbacktrigger controlid="CormantRadTabStrip1" eventname="???" />
     </triggers>
</asp:updatepanel>

and I have some related javascript:

function CloseAndSave() {
    window.__doPostBack(CormantRadTabStrip1);
}

On the server-side I have made bar implement the IPostBackEventHandler interface.

There doesn't seem to be an explicit event name for this sort of thing, though? What should I sent the eventname to be?

Thanks

public class CormantRadTabStrip : RadTabStrip, IPostBackEventHandler
{
    /// <summary>
    /// This is called when the GlobalSettings dialog window closes.
    /// </summary>
    /// <param name="eventArgument">JSON passed to the event representing state of tabs</param>
    void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
    {
        UpdateTabs();
    }
}

Upvotes: 0

Views: 1965

Answers (2)

VadimB
VadimB

Reputation: 5711

You can add hidden Button and specify OnClientClick event handler to window.__doPostBack(CormantRadTabStrip1);

Then modify AsyncPostBackTrigger with following

<triggers>
    <asp:asyncpostbacktrigger controlid="YouButtonID" eventname="ClientClick" />
</triggers>

Upvotes: 0

Nick Rolando
Nick Rolando

Reputation: 26167

The eventname should be whatever type of event your bar (or CormantRadTabStrip1) control causes the postback. See the msdn doc for some common (default) eventname values.

Upvotes: 1

Related Questions