Skip to main content

Creating Master-Detail GridView Using jQuery

Abstract:
In the year 2005 we published an article about creating master-detail GridView control. JQuery was not a first class citizen during that time and most of the work was performed by either plain old vanilla JavaScript or the server side code. With the advent of JQuery we can now create cool master-detail effects easily in less time and less code. This article explains how to spice up master-detail using JQuery

Data Source:

For the sake of simplicity we have used collections as the data source instead of the database. The scenario revolves around Category and Product classes. The implementation below is used to populate the categories collection and return it to the user interface.

public class DataAccess
02 {
03 public static List GetCategories()
04 {
05 var categories = new List();
06
07 for(var i = 1; i<=10;i++)
08 {
09 var category = new Category();
10 category.Name = "Category " + i;
11 category.Description = "Description for Category " + i;
12 category.Products = new List();
13
14 for(var j=1; j<=10;j++)
15 {
16 var product = new Product() {Name = "Product " + j, Price = 10*j};
17 category.Products.Add(product);
18 }
19
20 categories.Add(category);
21 }
22
23 return categories;
24 }
25 }

Comments

Popular posts from this blog

Drawing Line Charts In asp.net

LineChart.cs import the following namespaces using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.Collections; public class LineChart { public Bitmap Bitmapb; public string strTitle = "Default Title"; public ArrayList ArrayListchartValues = new ArrayList(); public float ftXorigin = 0, ftYorigin = 0; public float ftScaleX, ftScaleY; public float ftXdivs = 2, ftYdivs = 2; private int intWidth, intHeight; private Graphics Graphicsg; private Page Pagep; struct datapoint { public float ftx; public float fty; public bool bolvalid; } //initialize public LineChart(int intmyWidth, int intmyHeight, Page myPage) { intWidth = intmyWidth; intHeight = intmyHeight; ftScaleX = intmyWidth; ftScaleY = intmyHeight; Bitmapb = new Bitmap(intmyWidth, intmyHeight); Graphicsg = Graphics.FromImage(Bitmapb); Pagep = myPage; } pu...