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();         }     }

QueryString Encode & Decode

QueryString Encode & Decode Helper Class public class clsQueryString { static public string QueryStringEncode( string value) { return clsEncryptionDecryption .GetEncrypt(value); } static public string QueryStringDecode( string value) { return clsEncryptionDecryption .GetDecrypt(value); } public static string GetValueFromQueryString( string value, string key) { string strValue = string .Empty; if (value != null ) { string DataString = clsEncryptionDecryption .GetDecrypt(value); Hashtable objHash = clsQueryString .GetQueryString(DataString); strValue = clsCheckDBNull .ConvertToStr(objHash[key]); return strValue; } else return "" ; } publi...