Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
265
Programmatically create grid, columns and rows in hierarchy.
posted

Hi all, i have successfully created a grid in code with columns and rows, however i am unable to create the hierarchy in code.

 we uses old school multidimensional arrays here(not my choice), so i am unable to use the traditional dataset or collection.

 Essessional i loop through in page_load and create all my columns on grid, then i loop through each row and create individual cells, that all works as long as i dont call .DataBind() on the grid, however i am unable to actually create that child band and dynmically bind that data so the hierarchy works, please help or tell me if i am wasting my time.

code below:

UltraWebGrid grid = setupGrid();

// Add columns to grid.

foreach (Column columnn in columns) {

grid.Columns.Add(columnn.DisplayName, columnn.DisplayName);

}

// Add rows to grid.

for (int i = 0; i < data.Length; i++) {

UltraGridRow row = new UltraGridRow();

for(int j = 0; j < data[i].Length; j++)

{

Column column = dd.getColumnAt(j);

if (column.Type == mincom.abstraction.ColumnType.CTDATASET) { //We have nested data, do somethiong here.

} else {

row.Cells.Add(new UltraGridCell(data[i][j]));

}

}

grid.Rows.Add(row);

}

Thanks

Rob

Parents
No Data
Reply
  • 8680
    posted

    IIRC, when you add columns and rows to a grid, without specifying which band, everything goes to band(0).

    You may need to use "grid.bands(N).columns" in places where you've used "grid.columns".

    HTH

Children
No Data