views:

12

answers:

0

Hi All, I am trying to bind columns to dataviewgrid dynamically. But it shows compiling time error with red wavy line.

I have set autogeneratecolumn=false; and have written following:

gvData.datasource = dsGetMasterdata.table[0];

BoundColumn bc = new BoundColumn();

bc.DataField = dsGetMasterData.Tables[0].Columns[i][0].ToString();

bc.HeaderText = dsGetMasterData.Tables[0].Columns[i][1].ToString();

gvData.Columns.Add(bc); <--- here it is not allowing me to compile

gvData.databind();

I could not understand what going wrong.

Any suggestions, hints or code sample would be welcome. Thanks for your time -Hitesh