Reputation: 11
I have a datagridview, I am binding this grid with SQL, I have added five rows in datagrid as same in sql with autogeneratecolumn = false.
.
my code is
string qry1 = "select modal,Spec,color,Types,reqQty from godownRequsition where gr='" + txtGr.Text + "'";
dataGridView1.DataSource = DAL.GetdataTable(qry1);
the problem is that when I run the program, the rows of datagrid could not show the data. If I finish all the column in datagrid and autogenerate column is true it show the data..
now I want to bind the datagrid with my own generated columns not autogenerated.
Upvotes: 0
Views: 162
Reputation: 500
You need to create the column by your self like this :
DataGridViewColumn column = new DataGridViewTextBoxColumn();
column.HeaderText = "Lama";
int indexCol = grid.Columns.Add(column);
Upvotes: 1