Calling ASP.NET Code Behind function from JavaScript

yes, you can make web method like..

<WebMethod(EnableSession:=True), ScriptMethod()> _ 
Public Shared Function updateContent() As String
      Return "Your String"
    End Function

and then call in javascript like..

PageMethods.updateTabContent(parameterValueIfAny, onSuccessMethod,onFailMethod);

this also need to add

<asp:ScriptManager ID="ScriptMgr" runat="server" EnablePageMethods="true">
                </asp:ScriptManager>

Leave a Comment