Accessing Invisible Columns of Datagrid ( No big deal !! )

You can always access the Datagrid invisible column through looping. Most of the time when you display data in the Datagrid you hide the first column since its a primary key. Now if you want to access that column you can easily use a DataGridItem to loop through each item of the Datagrid. This is not the only method to access the invisible column. If you have a select column in the Datagrid you can use that also.

	private void Button1_Click(object sender, System.EventArgs e)
		{
			foreach(DataGridItem dgi in DataGrid1.Items) 
			{
				Response.Write(dgi.Cells[0].Text); 
			}

		}

Print | posted @ Tuesday, July 26, 2005 12:45 PM

Twitter