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
How do I convert an UltraGridRow to a WebDataGrid?

Here is the old code that was used to provide the data:

protected void GenerateSalaryPunchesTable()

string[] DateRange = this.cboPayPeriods.SelectedItem.Text.ToString().Replace(" ", "").Split('-');

while (Convert.ToDateTime(DateRange[0]) <= Convert.ToDateTime(DateRange[1]))
if (Convert.ToDateTime(DateRange[0]).DayOfWeek != DayOfWeek.Saturday & Convert.ToDateTime(DateRange[0]).DayOfWeek != DayOfWeek.Sunday)
//Infragistics.Web.UI.GridControls.ControlDataRecord nRow =
//ControlDataRecord nRow = new Infragistics.WebUI.UltraWebGrid.UltraGridRow();
//ControlDataRecord nRow = new GridRecord();
//ControlDataRecord nRow = new ControlDataRecord();
Infragistics.WebUI.UltraWebGrid.UltraGridRow nRow = new Infragistics.WebUI.UltraWebGrid.UltraGridRow();

// Date Cell
// Worked CB
// Vacation CB
// Sick CB
// Holiday CB
// Error

nRow.Key = Convert.ToDateTime(DateRange[0].ToString()).ToShortDateString();
nRow.Cells[0].Value = Convert.ToDateTime(DateRange[0].ToString()).ToShortDateString();
nRow.Cells[1].Value = 0;
nRow.Cells[2].Value = 0;
nRow.Cells[3].Value = 0;
nRow.Cells[4].Value = 0;
nRow.Cells[5].Value = "";


DateRange[0] = Convert.ToDateTime(DateRange[0]).AddDays(1).ToShortDateString();


It doesn't like this line: this.dgvPunchs.Rows.Add(nRow);

Because the new control wants a ControlDataRecord instead of an UltraGridRow. I am very new to both classic controls and the new controls.  Can someone tell me how I can rewrite the above to make it work?  I've been working on this for hours and keep running into road blocks.

  • 37874
    Suggested Answer

    Hello James,

    In WebDataGrid it is not possible to add rows the same way as with UltraWebGrid. WebDataGrid does not support unbound mode, so you should add the desired rows to the datasource you are binding to. For example you could create a DataTable with your data and set the DataSource property of the grid to this DataTable:

    WebDataGrid1.DataSource = myDataTable;

    Feel free to contact me if you have any further questions.

Reply Children
No Data