public static string TestAjax() { // lblName.Text = "Hello, Async"; WebForm1 webForm = new WebForm1(); if (webForm.lblName != null) { webForm.lblName.Text = "Hello,Async"; } Thread.Sleep(3000); return "true"; }
[WebMethod]//从前台调用必须是static方法 public static string TestAjax() { // lblName.Text = "Hello, Async"; WebForm1 webForm = new WebForm1(); if (webForm.lblName != null) { webForm.lblName.Text = "Hello,Async"; } Thread.Sleep(3000); return("true"); }