string js;
js = "";
js += "function CallWebServices(){";
js += "AutoComplete.GetLoginUserCount(onOK);";
js += "}";
js += "function onOK(returnData){";
js += "$get('TextBox1').value=returnData;";
js += "}";
js = "<script>" + js + "</script>";
ClientScript.RegisterStartupScript(typeof(string), "", js);
Button1.Attributes.Add("onclick", "CallWebServices();");
ScriptManager1.Services.Add(new System.Web.UI.ServiceReference("AutoComplete.asmx"));
[WebMethod]
public string GetLoginUserCount()
{
string UserCount="0";
UserCount = Convert.ToString(SqlHelper.ExecuteScalar(ConfigurationSettings.AppSettings["connString"], "GetUsersLoginedCount")).Trim();//已登陆用户总数
return UserCount;
}