How do I access the "BoundField" value in the RowDataBound gridview event?
DataRowView drv = (DataRowView)e.Row.DataItem; if (e.Row.RowType == DataControlRowType.DataRow) { if (drv["MYCOLNAME"] != DBNull.Value) { var val = Convert.ToBoolean(drv["MYCOLNAME"]); } }
Just convert to the correct type.
BoundField is indicated by column wise in GridView, so basically RowDataBoundit doesn't matter here;).
GridView
RowDataBound
it can be accessed through
GridView.Columns;
as
BoundField b = myGridView.Columns[columnindex] as BoundField;