|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Hiding grid columns based on some value in rowI 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. *** Sent via Developersdex http://www.developersdex.com ***
Why Does This Not Work?
Datagrid default date format Visual Studio 2005 -- Multi-Tabbed Control Unable to retrieve schema - Divide by zero error encountered GridView - Hyperlink DataView Borders Editing/Deleting/Inserting Records using ASPxGridView Removing a control from a DataList Controlstyle How do I remove Datagrid Spacing? |
|||||||||||||||||||||||