private void WriteJson(HttpContext context, DataTable data) { context.Response.ContentType = "text/javascript"; ForeignLookupResult[] results = new ForeignLookupResult[data.Rows.Count]; for (int x = 0; x < results.Length; x++) { DataRow row = data.Rows[x]; results[x] = new ForeignLookupResult { t = DatabaseExtender.Cast <String>(row["Text"]) ?? "", v = DatabaseExtender.Cast <int?>(row["Value"]) ?? 0 }; } context.Response.Write(JsonConvert.SerializeObject(results)); }
private void WriteJson(HttpContext context, DataTable data) { context.Response.ContentType = "text/javascript"; ForeignLookupResult[] results = new ForeignLookupResult[data.Rows.Count]; for (int x = 0; x < results.Length; x++) { DataRow row = data.Rows[x]; results[x] = new ForeignLookupResult { t = DatabaseExtender.Cast<String>(row["Text"]) ?? "", v = DatabaseExtender.Cast<int ?>(row["Value"]) ?? 0 }; } context.Response.Write(JsonConvert.SerializeObject(results)); }