Populate grid one row at a time

2 posts, 0 answers
  1. Robert
    Robert avatar
    3 posts
    Member since:
    Feb 2013

    Posted 02 Apr 2013 Link to this post

    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
  2. Jayesh Goyani
    Jayesh Goyani avatar
    2733 posts
    Member since:
    May 2010

    Posted 02 Apr 2013 Link to this post

    Hello,

    Please check below link.

    Add row to grid without DataSource

    Thanks,
    Jayesh Goyani
Back to Top