We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to selectively disable linkbuttons in datagrid cell

This is my first post...I hope I am following by all protocols... I have a datagrid with the first cell containing a "Delete" linkbutton (eg: a ButtonColumn as defined in datagrid's PropertyBuilder). As I build the data into the grid, I test the current datagrid record to determine if it is already marked as "deleted" ('ExpirationDate' column value less than today's date) such that a deleted record should not have the "Delete" linkbutton 'active' (eg: clickable). In all other cases, the "Delete" linkbutton should be 'active'. I have tried several of the following statements inside a method executed by the datagrid's "OnItemDataBound" event but find that the links still remain 'active' even though they appear in the typical disabled grey coloring: --------code snippet start-------- string expdate= ((DataRowView)e.Item.DataItem).Row.ItemArray[4].ToString(); DateTime dt = Convert.ToDateTime(expdate) if (dt <= DateTime.Today) { //next line disables link in cell....but you can still click link e.Item.Cells[0].Enabled = false; //next line disables entire row...but you can still click link e.Item.Enabled = false; //next line hides link but actually removes 1st cell entirely....giving ugly left shift of current record e.Item.Controls[0].Visible = false; } --------code snippet end-------- Many thanks in advance!

1 Reply

AD Administrator Syncfusion Team March 22, 2003 11:05 PM UTC

This forum is for questions regarding Essential Grid, not the Windows Forms DataGrid. Try posting in the Windows Forms FAQ forum or on Microsoft newsgroups. Stefan

Live Chat Icon For mobile
Up arrow icon