C# .NET - how to disable link button in datagridview in c#

Asked By oum maroua on 15-May-17 06:24 AM
I have textbox and a datagrid view that contains three links I want to desactivate the links at the beginning after when I filled out for example the textbox1 the first link will activate how to do please and thanks in advance

i tried this code 

if (textBox4.Text == "0" && textBox4.Text == "0" && textBox4.Text == "0")
                dataGridView2.Rows.Cell[1].Enable = true;

but it doesn't work
Atikur Zaman replied to oum maroua on 31-Jul-17 04:57 PM
protected void textBox4_TextChanged(object sender, EventArgs e) { // Loop through all rows in the grid foreach (GridViewRow row in grid.Rows) { // Only look for `lbClose` in data rows, ignore header and footer rows, etc. if (row.RowType == DataControlRowType.DataRow) { // Find the `lbClose` LinkButton control in the row LinkButton theLinkButton = (LinkButton)row.FindControl("lbClose"); // Make sure control is not null if(theLinkButton != null) { // Enable the link button theLinkButton.Enabled = true; } } } }