Disable save button in gridview
<p>I have Save button as part of 'EditItemTemplate' of the grid. on click of the button I want to disbale the button to have a single click disable effect.</p>

<ol>
<li>I did try with javascript, in this case no server side code is executed. </li>
<li>Added the attribute to the button, even this doen't help</li>
<li>Tried by adding 'UseSubmitBehavior="false"' property too</li>
</ol>

<p>What would be other possible solution to achieve this?</p>

<p>Thanks</p>

<p><strong>Here is the solution</strong>:
1) Set the UseSubmitBehavior="false" for the button in aspx page.
2) In the .cs page, in the RowDataBound event write the following code</p>

<pre><code>///Grid row event RowDataBound
protected void gvr_RowDataBound(object sender, GridViewRowEventArgs e)
{
   if (e.Row.RowType == DataControlRowType.DataRow)
   {
       if ((e.Row.RowState &amp; DataControlRowState.Edit) &gt; 0)
       {
            ///Creating the Save button object
            Button btn = (Button)e.Row.Cells[6].FindControl("btnSave");

            ///Add the attribute to disblae the button
            btn.Attributes.Add("onclick", "this.disabled=true;");
       }
   }
}
</code></pre>

<p>Solved!</p>
