0

I have a bunch of JS on a page and when a certain link is clicked, this is called:

// The args telss me what link is clicked and what page to login to
var pageId = '<%=  updateAuth.ClientID %>';
__doPostBack(pageId, args);

UpdateAuth is an update panel like so:

<asp:UpdatePanel ID="updateAuth" runat="server">
<ContentTemplate>
    // Html is here to set up the authentication layer
    <asp:UpdatePanel ID="updateLogin" runat="server">
        // Login authentication
    </asp:UpdatePanl>
    // Other panels to create account and change password and forgot password

Is there any different way to make this go faster when the user clicks the link to start this process? I am trying to only do an partial page refresh. Thanks.

cdub
  • 24,555
  • 57
  • 174
  • 303

1 Answers1

0

There's another way that skips the page life cycle and also consumes only the necessary amount network data resulting in faster response times: WebMethods

Basically, a WebMethod is a static method that you define Server-side and can be called Client-side. The main issue is that these methods are static so you cannot access session variables or Viewstate controls directly like you usually do in standard event methods of Web Forms framework.

To learn the differences between WebMethods and UpdatePanels and also what are the main problems of asp:UpdatePanel read updatepanel vs page methods

Here is an example of how to call WebMethods from JavaScript.

Here is an example of how to call WebMethods from JQuery using AJAX.

Regards!

Community
  • 1
  • 1
DiegoS
  • 816
  • 1
  • 10
  • 26