This is a migrated thread and some comments may be shown as answers.

Populate grid one row at a time

1 Answer 70 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 2
Robert asked on 02 Apr 2013, 04:01 PM
I would like to populate a grid the same way that I populate a combo box using datarows from a dataset

The following is the code that I use to populate my combo boxes

using (DataSet dsDept = WSAccess.StepsGlobal_GetCodeTable("codDepartments"))
{
    if (Globals.IsValidDataSet(dsDept))
    {
        foreach (DataRow row in dsDept.Tables[0].Rows)
        {
            RadComboBoxItem rcbi = new RadComboBoxItem(row["DESC"].ToString(), row["ID"].ToString());
            combo.Items.Add(rcbi);
 
        }
    }
}

How would I populate a grid.

I thought I could do something like the following.
using (DataSet dsDept = WSAccess.StepsGlobal_GetCodeTable("codDepartments"))
{
    if (Globals.IsValidDataSet(dsDept))
    {
        foreach (DataRow row in dsDept.Tables[0].Rows)
        {
>>>>>>       RadGridItem rcbi = new RadGridItem(row["DESC"].ToString(), row["ID"].ToString());
>>>>>>        RadGrid.Items.Add(rcbi);
 
        }
    }
}
Of course this does not work.

Again I would like to fill in the grid one row at a time.
FYI: This grid contains three columns and could have as many as 200 rows.
I am looking to do this at the PreRender event.

Thanks

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 03 Apr 2013, 04:49 AM
Hello,

Please check below link.

Add row to grid without DataSource

Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Robert
Top achievements
Rank 2
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or