Hi, you are trying to add a new row which has 3 columns while you have zero(0) columns in your datatable ds. Solution: add columns to datatable.
Note: if you have added any databound column in your gridview1, make sure the column names of your dataset/datatable ds have the same names as in the DataField of your gridview Databound columns.
Try this code:
protected void Add_Click(object sender, EventArgs e)
{
DataTable ds = new DataTable();
ds.Columns.Add(new DataColumn("Col1", typeof(string)));
ds.Columns.Add(new DataColumn("Col2", typeof(string)));
ds.Columns.Add(new DataColumn("Col3", typeof(string)));
GridView1.Visible = true;
ds.Rows.Add(TextBox1.Text, TextBox2.Text, TextBox3.Text);
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
GridView1.DataSource = ds;
GridView1.DataBind();
GridView1.DataSource = null;
}