ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Disable Button on Click in ASP.Net MVC<p>Hi&nbsp;nauna,</p> <p>Check this example. Now please take its reference and correct your code.</p> <p><strong><span style="text-decoration: underline;">Controller</span></strong></p> <pre class="brush: csharp">public class HomeController : Controller { // GET: /Home/ public ActionResult Index() { return View(); } public ActionResult Save() { // ... do something task ViewData[&#34;IsEnabled&#34;] = false; return View(&#34;Index&#34;); } }</pre> <p><strong><span style="text-decoration: underline;">View</span></strong></p> <pre class="brush: html">&lt;html&gt; &lt;head&gt; &lt;title&gt;Index&lt;/title&gt; &lt;script type=&#34;text/javascript&#34; src=&#34;https://code.jquery.com/jquery-2.2.3.js&#34;&gt;&lt;/script&gt; &lt;script type=&#34;text/javascript&#34;&gt; $(function () { var enabled = &#39;&lt;%= ViewData[&#34;IsEnabled&#34;] %&gt;&#39; if (enabled == &#39;False&#39;) { $(this).removeAttr(&#34;disabled&#34;); $(this).val(&#34;Save&#34;); } $(&#39;#btnSave&#39;).on(&#39;click&#39;, function () { $(this).attr(&#39;disabled&#39;, &#39;disabled&#39;); $(this).val(&#34;Progressing.....&#34;); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div&gt; &lt;%using (Html.BeginForm(&#34;Save&#34;, &#34;Home&#34;, FormMethod.Post)) {%&gt; &lt;input type=&#34;submit&#34; id=&#34;btnSave&#34; value=&#34;Save&#34; /&gt; &lt;% } %&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;</pre> <p><strong><span style="text-decoration: underline;">Screenshot</span></strong></p> <p><strong><span style="text-decoration: underline;"><img src="https://i.imgur.com/YGruJMx.gif" alt="" width="250" height="99" /></span></strong></p>https://www.aspforums.net:443/Threads/923752/Disable-Button-on-Click-in-ASPNet-MVC/https://www.aspforums.net:443/Threads/923752/Disable-Button-on-Click-in-ASPNet-MVC/Wed, 15 May 2019 03:05:34 GMT