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
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.Captionuwg.Columns.Add(ugCol);...UltraGridRow ugRow;...ugRow = new UltraGridRow(true); // Create the row and ensure it is stored in ViewStateuwg.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.
I did your code.... but I have some error at this line:
uwg.Cells.FromKey("1").Value = "allo";
I receive this message:
Error 3 'Infragistics.WebUI.UltraWebGrid.UltraWebGrid' does not contain a definition for 'Cells' and no extension method 'Cells' accepting a first argument of type 'Infragistics.WebUI.UltraWebGrid.UltraWebGrid' could be found (are you missing a using directive or an assembly reference?)
Plus, can I put the string "allo" like a hyperLinkButton
Thanks you