[asp.net]在RowDataBound存取asp:bound欄位

  • 1112
  • 0

摘要:[asp.net]在RowDataBound存取asp:bound欄位


DataRowView drv = (DataRowView)e.Row.DataItem; 
if (e.Row.RowType == DataControlRowType.DataRow) 
{ 
if (drv["MYCOLNAME"] != DBNull.Value)
{
  var val = Convert.ToBoolean(drv["MYCOLNAME"]);
} 
}

以上參考

http://stackoverflow.com/questions/5404914/in-an-asp-net-gridview-how-do-i-access-a-boundfield-in-the-rowdatabound-event