Posted on: 12/3/2014 9:39:55 PM | Views : 368

I have a gridview with a HyperLinkField DataNavigateUrlFields. The gridview is in the order:
details id title length director
It's populated from a table from the code behind the url is tied to id (hence why i need it):
OleDbCommand cmd = new OleDbCommand(CS);
cmd.Connection = con;
cmd.CommandText = ("SELECT id, title, length, director FROM movies WHERE title LIKE '" + movieletter + "%'");
con.Open();
GridView1.DataSource = cmd.ExecuteReader();
GridView1.DataBind();
GridView1.Columns[1].Visible = false;
the gridview populates no problem but I want to hide the id column in the gridview
the line - GridView1.Columns[1].Visible = false; - doesn't do anything. If I change [1] to [0] it gets rid of the details column. If I go above [1] I get an error:
System.ArgumentOutOfRangeException was unhandled by user code HResult=-2146233086 Message=Index was out of range. M ...

Go to the complete details ...