C# – cancel gridview row edit mode programatically using C#

buttonclickcgridview

I am using a Editable GridView. On clicking edit button of a row, the row is coming in Editable mode and once I update the details of a current row, the row is getting saved and comes in normal mode.

Here I face one issue. When I make row to a Editable mode, On click of a button (which is not a part of grid) I want to bring Editable row mode to a normal mode.

Best Answer

Change the gridview's EditIndex value to -1.

protected void Button1_Click(object sender, EventArgs e)
    {
        GridView1.EditIndex = -1;
    }
Related Topic