通过[AjaxMethod(AjaxPro.HttpSessionStateRequirement.ReadWrite)]html页面调用cs的方法
cs页面:
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Text; using AjaxPro; //主要 [AjaxMethod(AjaxPro.HttpSessionStateRequirement.ReadWrite)] public string Selook() { string sql = "select * from tbMessageinfo where user_to='" + CUser.NSID + "' and color='0'"; bool aa = u.SelectGrade(sql); string sql1 = "select * from Onlinetips where user_to='" + CUser.NSID + "'"; DataTable dt = u.GetListGrade(sql1); StringBuilder s = new StringBuilder(); for (int i = 0; i < dt.Rows.Count; i++) { s.Append(dt.Rows[i]["Information"].ToString()); } string sql2 = "update tbMessageinfo set color='1' where user_to='"+CUser.NSID+"'"; bool isno = u.ListGrade(sql2); string sqls = "delete Onlinetips where user_to='" + CUser.NSID + "'"; bool fang=u.ListGrade(sqls); return "{f:'" + aa.ToString() + "',c:'" + s.ToString()+ "'}"; }
html页面:
直接通过js调用。
<script>document.write(UserManageBase.getmun().value)</script>