Professional UI Solutions
Site Map   /  Register
 
 
 

Elegant Grid

Data Bound Grid

Data binding to jagged arrays

« prev |  index |  next »

      

The Elegant Grid supports data binding to two-dimensional jagged arrays. The jagged array is a one-dimensional array whose elements are one-dimensional arrays of variable length.

Here is an example of the jagged array:

[C#]
 object[][] dataSource = new object[5][]
   {
      new object[]{"Kevin", "Task 1", 40},
      new object[]{"Roberto", "Task 2", 15},
      new object[]{"David", "Task 3", 70},
      new object[]{"Gail", "Task 4", 35},
      new object[]{"Ashvini", "Task 5", 88}
   };

[VB.NET]
Dim dataSource()() As Object = _
   { _
      New Object() {"Kevin", "Task 1", "40"}, _
      New Object() {"Roberto", "Task 2", 15}, _
      New Object() {"David", "Task 3", 70}, _
      New Object() {"Gail", "Task 4", 35}, _
      New Object() {"Ashvini", "Task 5", 88} _
   }

With few lines of code you can bind the above two-dimensional array to the bound grid. The result is shown in Figure 1.

Data bound grid displaying the contents of a jagged array

Data bound grid displaying the contents of a jagged array