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

Creating columns add runtime

1 Answer 78 Views
GridView
This is a migrated thread and some comments may be shown as answers.
IT Development
Top achievements
Rank 1
IT Development asked on 12 May 2009, 09:39 AM
Hello,

i have a problem with the winform radgrid.

Trying to add columns runtime with the following loop:

 

 

 

public void CreateGridProductieMonitor(List<string> Kolommen)

 

{

radGridViewProductie.DataSource = schrapViewBindingSource;

 

foreach (string Kol in Kolommen)

 

{

 

if (!string.IsNullOrEmpty(Kol.Trim()))

 

{

 

     GridViewTextBoxColumn textBoxColumn = new GridViewTextBoxColumn();

 

     textBoxColumn.UniqueName = Kol;

     textBoxColumn.HeaderText = Kol;

     textBoxColumn.FieldName = Kol;

 

 

 

     radGridViewProductie.MasterGridViewTemplate.Columns.Add(textBoxColumn);

 

}

}

}

 

 

 


The datasource of the grid is a generic list. The fieldname is 100% correct. 
Only the first column shows data. The other columns are empty. When i change the order of the columns the result is the same. The first column added shows data.
I tried adding the columns before and after binding to the datasource.

Greetings Tim

 

1 Answer, 1 is accepted

Sort by
0
IT Development
Top achievements
Rank 1
answered on 12 May 2009, 10:41 AM
Found the problem.
Spaces in the column name.


Greetings Tim
Tags
GridView
Asked by
IT Development
Top achievements
Rank 1
Answers by
IT Development
Top achievements
Rank 1
Share this question
or