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 }
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
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
Post a Comment