i need a code to call a javascript function from my static webmethod.
plz help.......
thanks in advance
[System.Web.Services.WebMethod]
public static string password(string UserId, string UserName, string Password, string ConPassword, string EmailId, string Country, string date)
{
TextBox TxtUserId = new TextBox();
TextBox TxtPassword = new TextBox();
string flag = "";
date = DateTime.Now.ToString("dd/MM/yyyy");
ScriptManager MyScriptManager = new ScriptManager();
MyScriptManager = (ScriptManager)HttpContext.Current.Session["Script"];
Page page1 = HttpContext.Current.CurrentHandler as Page;
TxtUserId = (TextBox)HttpContext.Current.Session["TxtUserId"];
TxtPassword = (TextBox)HttpContext.Current.Session["TxtPassword"];
try
{
if (Password.Trim().Replace(" ", "") != ConPassword.Trim().Replace(" ", ""))
{
flag = "false1";
return flag;
}
else
{
page1.ClientScript.RegisterStartupScript(page1.GetType(), "id", "GetUserIdMessage()", true);
MyFunctions Functions = new MyFunctions();
Functions.insertLogin("insert into UserLogin values('" + UserId.Trim().Replace(" ", "") + "','" + UserName.Trim().Replace(" ", "") + "','" + Password.Trim().Replace(" ", "") + "','" + EmailId.Trim().Replace(" ", "") + "','" + Country.Trim().Replace(" ", "") + "','" + date.Trim().Replace(" ", "") + "')");
flag = "true";
return flag;
}
}
catch (Exception ex)
{
return ex.Message.ToString();
}
}