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
49
How to manually adding cell in ultraWebGrid
posted

I want to put some value in the ultraWebGrid. This is my code:

uwg = new UltraWebGrid();

 UltraGridRow ugRow = new UltraGridRow();
 uwg.Rows.Add(ugRow);

UltraGridCell ugCell = new UltraGridCell();
 uwg.Rows[Convert.ToInt32(rowTest["DTC01"])].Cells.Add(ugCell);
                                    uwg.Rows[Convert.ToInt32(rowTest["DTC01"])].Cells[Convert.ToInt32(rowTest["DTC02"])].Value = "allo";
wb.ContentPane.Controls.Add(uwg);

For me, I think this code can display "allo". I receive "no data can be display"

Why? and I want the text "allo" appear like a hyperLinkButton

Anyway Im lost, any help can be good.

Gabriel Deschênes

Parents
No Data
Reply
  • 45049
    Suggested Answer
    posted

    Define columns to add to your grid first.  Thus, when you add a row to the grid, it will get cells defined to match the column definitions - you don't need to create cell objects directly.

    I also recommend a different approahc to creating both your rows and your columns, which will ensure that they'll be stored in ViewState.

    using Infragistics.WebUI.UltraWebGrid;
    ...
    UltraGridColumn ugCol;
    ...
    ugCol = new UltraGridColumn(true); // Create the column and ensure it is stored in ViewState
    // Set other properties on the column here, such as its Key, its DataType, and its Header.Caption
    uwg.Columns.Add(ugCol);
    ...
    UltraGridRow ugRow;
    ...
    ugRow = new UltraGridRow(true); // Create the row and ensure it is stored in ViewState
    uwg.Rows.Add(ugRow); // This adds the row to the grid, and implicitly creates its cells
    // uwg.Cells.FromKey("MyColumn").Value = "allo";
    ugRow.Cells.FromKey("MyColumn").Value = "allo"; // Replace "MyColumn" with the Key property of the corresponding column
    ...
    wb.ContentPane.Controls.Add (uwg);

    EDIT:  Corrected a major typo in my original post.

Children