Dear Sir, I am retrieving data from database and bind to dynamic gridview. My problem is I am retrieving class details on the basis of teacher names,but the o/p will bind in not proper way can u please solve my problem. datatable dx = dk.Tables[0]; dx have some data datatable df=dc.Table[0]; df have another data and it bind to dynamic gridview. It does't display in properway. I am writing loop like this
int columnIndex = 1; DataColumn newColumn = dx.Columns.Add(tim1, typeof(string)); int newColumnIndex = dx.Columns.IndexOf(newColumn); for (int x = 0; x < df.Columns.Count; x++) { dx.Rows[x][newColumnIndex] = df.Rows[x][columnIndex]; } GridView3.DataSource = dx; GridView3.DataBind();