You are on page 1of 1

DataColumn dc1 = new DataColumn("CRMColumn", typeof(System.String)); DataColumn dc2 = new DataColumn("YourColumn", typeof(System.String)) ; DataColumn dc3 = new DataColumn("CRMIndex", typeof(System.

String)); DataColumn dc4 = new DataColumn("YourIndex", typeof(System.String)); dt.Columns.Add(dc1); dt.Columns.Add(dc2); dt.Columns.Add(dc3); dt.Columns.Add(dc4);

for (int i = 0; i < GridView1.Rows.Count; i++) { DataRow dr = dt.NewRow(); dr[dc1] = GridView1.Rows[i].Cells[0].Text.ToString(); dr[dc2] = GridView1.Rows[i].Cells[1].Text.ToString(); dr[dc3] = GridView1.Rows[i].Cells[2].Text.ToString(); dr[dc4] = GridView1.Rows[i].Cells[3].Text.ToString(); dt.Rows.Add(dr); } DataRow dr1 = dt.NewRow(); dr1[dc1] = ddlOur.Text; dr1[dc2] = ddlYour.Text; dr1[dc3] = ddlOur.SelectedIndex.ToString(); dr1[dc4] = ddlYour.SelectedIndex.ToString(); dt.Rows.Add(dr1); GridView1.DataSource = dt; GridView1.DataBind();

You might also like