Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1259
  • Last Modified:

Disabling Edit buttons in gridview

hello all,

I'm using the code below to disable the "delete" and "status" buttons while in edit mode. The problem I'm facing is that it only disables the "delete" and "status" button of the row which is in edit mode. The "delete" and "status" buttons for the rest of the rows are still visible. I want to disable them as well.

Any tips or idea would be appreciated
            gvUserLevel.EditIndex = e.NewEditIndex;
            PopulateUserLevelDataGrid();
            Button btn = (Button)gvUserLevel.Rows[e.NewEditIndex].FindControl("btnDelete");
            btn.Enabled = false;
            Button btn1 = (Button)gvUserLevel.Rows[e.NewEditIndex].FindControl("btnStatus");
            btn1.Enabled = false;
            TextBox txtUserLevel = (TextBox)gvUserLevel.Rows[e.NewEditIndex].FindControl("EditUserlevelName");
            txtUserLevel.Text = txtUserLevel.Text.Trim();

Open in new window

0
AvinashKN
Asked:
AvinashKN
1 Solution
 
jmwheelerCommented:
foreach (GridViewRow row in gvUserLevel.Rows)
{
            ((Button)row.FindControl("btnDelete")).Enabled = false;
            ((Button)row.FindControl("btnStatus")).Enabled = false;
}
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now