Ajax asynchronously updates local data without refreshing
- 2020-05-27 04:42:30
- OfStack
<asp:ScriptManager ID="smScriptManager" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="upLinkmanList" UpdateMode="Conditional" runat="server">
<ContentTemplate>
// The part of the data to be updated, such as 1 a Repeater, Includes paging controls;
</ContentTemplate>
</asp:UpdatePanel>
// The background needs to register the page as Ajax
AjaxPro.Utility.RegisterTypeForAjax(typeof( The page to register for Inherits At the end of the 1 The page is: CustomerList.aspx, So this right here is CustomerList));
// Register the asynchronous control, lnkbtnRefreshLinkman10 a Linkbutton, Used to invoke the background data update method;
this.smScriptManager.RegisterAsyncPostBackControl(lnkbtnRefreshLinkman);
// Registration page control this.smScriptManager.RegisterAsyncPostBackControl(this.Pager);
/// <summary>
/// Refresh the contact list
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void RefreshLinkmanList(object sender, EventArgs e)
{
// update Ajax The data contained in the control, Ajax The control of UpdateMode Must be specified as Conditional
upLinkmanList.Update();
}
// Called in the foreground script method Linkbutton the onclick Event. Remember to refer to the Jquery script file
$("#<%=lnkbtnRefreshLinkman.ClientID %>").click();