karan_21584 0 Light Poster

currently i m using asp.net with c# (2.0 framework).
here i created a datatable and put these values in gridview and i have displayed. But when i check the gridview row and column count, the row count is coming correctly. but the column count always remains 0. y? kindly help me... below i have attached the coding.........

DataTable DTable;
DataRow DRow;
DataColumn DCol;
sqlda=new System.Data.SqlClient.SqlDataAdapter("select tmp_values from tbl_table1", conn);
sqlda.Fill(ds);
DTable = new DataTable("Headers"); 
DCol = new DataColumn("Head");
DTable.Columns.Add(DCol);
DRow = DTable.NewRow(); 
for (int i = 0; i <ds.Tables[0].Rows.Count; i++)        {   
DCol = new DataColumn("" + ds.Tables[0].Rows[i][0].ToString() + "");  
DTable.Columns.Add(DCol);  
DCol = new DataColumn("" + ds.Tables[0].Rows[i][0].ToString() + " " + " Remarks"); 
DTable.Columns.Add(DCol); 
}   
DTable.Rows.Add(DRow);
GridView1.DataSource = DTable;
GridView1.DataBind();

DTable.Columns.Count = 5 (its correct, but when bind with gridview and check the column count its zero)

GridView1.Rows.Count = 1 (its correct)

GridView1.Columns.Count = 0 (its incorrect, the answer should be 5)


Help me!!! - KARAN