string[] myString1 = { "sum", "minus"};
DataTable dt = new DataTable();
dt.Columns.Add("Name", typeof(string));
foreach (string item in myString1)
{
System.Data.DataRow row = dt.NewRow();
row["Name"] = item; // Assign the string to the column
dt.Rows.Add(row); // Add the row to the DataTable
}
GridView1.DataSource = dt;
GridView1.DataBind();
No comments:
Post a Comment