ExtJS and. NET development examples (grid data display, paging, sorted)

Source: Internet
Author: User
Tags json static class tojson

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.