Row Editing in the grid doesn't work in first click
<p>I have a user control which contains a grid and three buttons for add,edit and delete.
I have placed this user control on an asp.net page.
I have OnClick events for these buttons.
When i click on add and delete buttons it's working fine but when i click on edit button,the onclick event of edit button is fired but the row in the grid doesn't appear in the edit mode, i have to click two times.
I don't know where is the problem.The onclick event handler for edit button is as follows:  </p>

<pre><code>protected void btnEditBankAccount_Click(object sender, EventArgs e)
        {
            grdBankAccounts.EditIndex = grdBankAccounts.SelectedIndex;
            grdBankAccounts.RowSelectingEnabled = false;

        }
</code></pre>

<p>Anyone please help.</p>

<p>my user control has a method which binds the grid to the data source, it's as follows</p>

<pre><code>public void SetSupplierData(SupplierType Supplier)
        {
            if (Supplier != null)
            {
                    ViewState["SupplierID"] = Supplier.SupplierId;
                    grdBankAccounts.DataSource = Supplier.BankAccounts;
                    grdBankAccounts.DataBind();
                    Session["BankAccounts"] = Supplier.BankAccounts;
         }
      }
</code></pre>

<p>the SetSupplierData method is called from the page where i have my user control.</p>
