using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Text; namespace TypeScriptExamples.AjaxServerSide { public partial class ModelReadStudent : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { int primaryKey; Response.ContentType = "text/plain"; Response.ContentEncoding = Encoding.UTF8; if (int.TryParse(Request.QueryString["id"], out primaryKey) == false) { // For this example we just return an ID // of zero. primaryKey = 0; } Response.Write(OutputValues(primaryKey, "Fred", 22)); } private string OutputValues(int id, string name, int age) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("id={0}", id); sb.Append("&"); sb.AppendFormat("name={0}", name); sb.Append("&"); sb.AppendFormat("age={0}", age); return sb.ToString(); } } }