using System; using System.Data; using System.Globalization; using System.Threading; using System.Web.Services; using System.Collections.Generic; using System.Web.UI.WebControls; using System.Runtime.Serialization.Json; using System.Web.Script.Serialization; public partial class Us : System.Web.UI.Page { public static DataTable dts; protected void Page_Load(object sender, EventArgs e) { bind(); } protected void LinkButton1_Click(object sender, EventArgs e) { Session["Lang"] = "zh-cn"; Response.Redirect(Request.Url.ToString()); } protected void LinkButton2_Click(object sender, EventArgs e) { Session["Lang"] = "en-us"; Response.Redirect(Request.Url.ToString()); } public void bind() { string sql; if (Session["Lang"] != null) { if (Session["Lang"] == "zh-cn") { sql = "select contents from othertab where typename='联系我们' order by dates desc"; } else { sql = "select Econtent as contents from othertab where typename='联系我们' order by dates desc"; } } else { sql = "select contents from othertab where typename='联系我们' order by dates desc"; } dts = DBH.DBHelper.GetDataSet(sql); } protected override void InitializeCulture() { if (Session["lang"] != null) { string lang = Session["lang"].ToString(); if (!String.IsNullOrEmpty(lang)) { //UICulture - 决定了采用哪一种本地化资源,也就是使用哪种语言 //Culture - 决定各种数据类型是如何组织,如数字与日期 Thread.CurrentThread.CurrentUICulture = new CultureInfo(lang); Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(lang); base.InitializeCulture(); } } } [WebMethod] public static string DelApL() { //List d = new List(); //for (int i = 0; i < 10; i++) //{ // person p = new person(); // p.Sex1 = i.ToString(); // p.Name1 = "马大海" + i.ToString(); // d.Add(p); //} //JavaScriptSerializer jss = new JavaScriptSerializer(); //return ("callbackparam(" + jss.Serialize(d) + ");"); //return "callbackparam({msg:'Hello World'});"; string callback = "callback"; string response = string.Format("'value1':'{0}','value2':'{1}'", 1, 2); string call = callback + "({" + response + "})"; return call; } } public class person { private string Name; public string Name1 { get { return Name; } set { Name = value; } } private string Sex; public string Sex1 { get { return Sex; } set { Sex = value; } } }