[System.Web.Services.WebMethod]
public static string Gettype(string type)
{
return type ;
}
i get type as blank
protected void posyback_Click(object sender, EventArgs e)
{
try
{
Qry = " SELECT FTYPE FROM STATUS,";
SqlCommand cmd = new SqlCommand(Qry, con);
SqlDataReader reader = cmd.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
H_TYPE.Value = reader["FTYPE"].ToString();
}}
ScriptManager.RegisterClientScriptBlock(this, typeof(System.Web.UI.Page), "settype", "settype();", true);
BindGrid();//function for binding grid
}
}
gettype is fired only after
ScriptManager.RegisterClientScript..............
function settype()
{
PageMethods.Gettype(document.getElementById("<%=H_TYPE.ClientID%>").value, OnSuccess);
alert ("hello");
}
though i get alert i get H_TYPE not defined
before this line i get the value in the hidden control
ScriptManager.RegisterClientScriptBlock(this, typeof(System.Web.UI.Page), "settype", "settype();", true);
and after this passing to the static function
but its blank
i checked the sample
the only difference is i activate the function on a button click event in code as above