如何根据通过数据绑定加载的数据启用/禁用列表窗口上的删除按钮?我试图通过 GridView1_DataBound 事件访问数据,但是当我在 GridView1.Rows 中看到正确的行数时,内容似乎是空的。
protected void GridView1_DataBound(object sender, EventArgs e)
{
foreach (GridViewRow row in GridView1.Rows)
{
//
// Don't display delete link for non-admin users. (This is working fine.)
//
((LinkButton)row.FindControl("DeleteLinkButton")).Visible = (DataAccess.GetUserInfo(true).UserType == DataAccess.UserType.Admin);
//
// TODO: Instead of just making the button visible, if it is visible, enable
// or disable based on the row's DATESTAMP column.
//
DateTime dateStamp = Convert.ToDateTime(row.Cells[11].Text); // NO DATA RETURNED??
}
}