Skip to main content

Call server side method using javascript

Call server side  method using javascript 

 

ServerSide Method:-

System.Web.Services.WebMethod]

public static string SetDownloadPath(string ID)
{
HttpContext.Current.Session["logo"] = ID;
return ID;
}
 

Javascript To Call:-

PageMethods.SetDownloadPath(id);


Need To change in Following:-



<cc1:ToolkitScriptManager ID="ScriptManager1" runat="server" ScriptMode="Release"
        EnablePageMethods="true">


</cc1:ToolkitScriptManager>

EnablePageMethods="true"

Comments

Popular posts from this blog

Tata Punch: A Compact SUV That Packs a Punch

Postback Page using Javascript in ASP.net

Postback Page using Javascript in ASP.net For Calling Function: __doPostBack('__Page', ''); Function: function __doPostBack(eventTarget, eventArgument) {         if (!theForm.onsubmit || (theForm.onsubmit() != false)) {             theForm.__EVENTTARGET.value = eventTarget;             theForm.__EVENTARGUMENT.value = eventArgument;             theForm.submit();         }     }

Custom calendar in asp.net

<form id="form1" runat="server">     <div>         <asp:DropDownList ID="ddlMonth" runat="server" OnSelectedIndexChanged="ddlMonth_SelectedIndexChanged"             AutoPostBack="true">             <asp:ListItem Text="Jan" Value="1"></asp:ListItem>             <asp:ListItem Text="Feb" Value="2"></asp:ListItem>             <asp:ListItem Text="Mar" Value="3"></asp:ListItem>             <asp:ListItem Text="Apr" Value="4"></asp:ListItem>             <asp:ListItem Text="May" Value="5"></asp:ListItem>       ...