I have a grid that has icons for 2 buttons edit and delete on each row. I
would like to make the buttons invisible if the dateoccured in the record in
the row is older than this week. How do I do that?
Bill
Hi,
To change the visibility of any button or any control based on some
condition in grid, you can create 1 function after binding the grid.
Say,
.
grdcustomers.databind();
CheckGridForVisibility();
add this function to your page..
public void CheckGridForVisibility()
{
for (int i = 0; i < grdCustomers.Rows.Count; i++)
{
Label lbldatetime =
(Label)grdCustomers.Rows[i].FindControl("lblDataTime");
if (lbldatetime.Text == DateTime.Today.ToString())
{
Button btnedit =
grdCustomers.Rows[i].FindControl("btnEdit");
btnedit.Visible = false;
}
}
}
Hope this will help you..
Regards,
Mansi Shah.