Recently a lot of friends care about ExtJS, I recently wrote a project management tool used to ExtJS, I combined. Net wrote a case about grid implementation for the needs of friends reference.
This example development environment is: Windows XP + SQL Server + Iis6+vs 2008 Beta2 (. NET Framework3.5)
Implementation steps:
1. Fetch data source
Here is the way to read data from the database to produce JSON for ExtJS grid calls.
(1) Using Scott Guthrie to produce JSON-formatted classes, this article can be accessed: http://weblogs.asp.net/scottgu/archive/2007/10/01/tip, its translation please visit: http:// Blog.joycode.com/scottgu/archive/2007/10/10/109268.aspx
< p> to build a class file JSONHelper.cs, the code is as follows:
JSONHelper.cs
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Web.Script.Serialization;
5namespace Web.Components
6{
7 public static class JSONHelper
8 {
9 public static string ToJSON(this object obj)
10 {
11 JavaScriptSerializer serializer = new JavaScriptSerializer();
12 return serializer.Serialize(obj);
13 }
14
15 public static string ToJSON(this object obj, int recursionDepth)
16 {
17 JavaScriptSerializer serializer = new JavaScriptSerializer();
18 serializer.RecursionLimit = recursionDepth;
19 return serializer.Serialize (obj);
20 }
21 }
22}
23