'Why does grid row change?

I have a asp.net page with a grid and, above the grid, fields showing the contents of the highlighted row and some buttons (edit, add, delete, etc...). If the user clicks the edit button then it enables the fields for editing. However, after enabling the fields the grid is then refreshed or something and the first row is then highlighted and the fields on the screen changes. Why? How do I stop this?

Code is below:

        protected void btnEdit_Click(object sender, EventArgs e)
    {
        ChangeButtons(null, EventArgs.Empty);
        ChangeFields(null, EventArgs.Empty);
        updatetype = "Edit";
    }

        protected void ChangeButtons(object sender, EventArgs e)
    {
        btnAdd.Enabled = !btnAdd.Enabled;
        btnCopy.Enabled = !btnCopy.Enabled;
        btnEdit.Enabled = !btnEdit.Enabled;
        btnDelete.Enabled = !btnDelete.Enabled;
        btnCancel.Enabled = !btnCancel.Enabled;
        btnSave.Enabled = !btnSave.Enabled;
        btnClose.Enabled = !btnClose.Enabled;
        btnSearchCredits.Enabled = !btnSearchCredits.Enabled;
        btnClearCredits.Enabled = !btnClearCredits.Enabled;
    }

               protected void ChangeFields(object sender, EventArgs e)
    {
        txtSrchCredible_ID.Enabled = !txtSrchCredible_ID.Enabled;
        txtSrchADP_ID.Enabled = !txtSrchADP_ID.Enabled;
        txtSrchStart_Date.Enabled = !txtSrchStart_Date.Enabled;
        txtSrchEnd_Date.Enabled = !txtSrchEnd_Date.Enabled;
        txtCredible_ID.Enabled = !txtCredible_ID.Enabled;
        txtADP_ID.Enabled = !txtADP_ID.Enabled;
        txtEmployee_ID.Enabled = !txtEmployee_ID.Enabled;
        txtStart_Date.Enabled = !txtStart_Date.Enabled;
        txtEnd_Date.Enabled = !txtEnd_Date.Enabled;
        txtReason.Enabled = !txtReason.Enabled;
        txtUnits.Enabled = !txtUnits.Enabled;
        txtPercentage.Enabled = !txtPercentage.Enabled;
        txtOther.Enabled = !txtOther.Enabled;
    }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source