RadGrid bug? First two columns missing.

2 posts, 0 answers
  1. hart
    hart avatar
    16 posts
    Member since:
    Jul 2008

    Posted 02 Dec 2009 Link to this post

    When manually adding data to a grid, the first two columns go missing.
    See attached Bitmap and code below.
    I am simply adding data to a Grid through via a table.
    DataTable dt = new DataTable();     
      for (int i = 0; i < 5; i++)     
       dt.Columns.Add(new DataColumn("Col: " + i.ToString(), typeof(string)));     
      for (int i = 0; i < 5; i++)     
      {     
       DataRow dr = dt.NewRow();     
       dt.Rows.Add(dr);     
      }     
      RadGrid1.DataSource = dt;     
      RadGrid1.Rebind();     
      for (int i = 0; i < 5; i++)     
       for (int j = 0; j < dt.Columns.Count; j++)     
        RadGrid1.Items[i].Cells[j].Text = j.ToString();    
     
    I thought this was going to be simple, but has turned into something a little more challenging.
    Any thoughts?
    Thanks,
    HH
  2. Roland
    Roland avatar
    156 posts
    Member since:
    Feb 2009

    Posted 02 Dec 2009 Link to this post

    Hello,

    In your code, try filling the datarow first, then bind to the grid:
     for (int i = 0; i < 5; i++)      
      {      
       DataRow dr = dt.NewRow();    
       dr[0] = ....  // etc 
       dt.Rows.Add(dr);      
      }      

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top