Programming Journal C#, Java, SQL and to a lesser extent HTML, CSS, XML, and regex. I made this so other programmers could benefit from my experience.

Sunday, September 16, 2007

DataGridView cell contents and header contents




// How do I get the contents of a GridView cell?
GridView1.Rows[0].Cells[0].Text;
// Note: This will only get the result data and not the table headers a.k.a. column names.

// How do I get the contents of a GridView table header (<th>) a.k.a. column name?
GridView1.Columns[0].HeaderText;

No comments: