hi
can any one tell me how can i call asp.net method from javascript function
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
rakesh chaudhariPosted Jul 10, 2012, 7:21 AM
firstly add this header file in code behind
using System.Web.Services;
[System.Web.Script.Services.ScriptMethod(UseHttpGet = true)] // httpget isn't necessary but often a good idea
[System.Web.Services.WebMethod(true)]
public static string CallCodeBehind(string argID)
{
return strErrormsg;
}
this is the asp.net function
and just it call as
on u r button
onclick="return CallCodeBehind('argument value')"
add this and get u r output
Have a happy coding