Disable Button on Click in ASP.Net MVC

Last Reply one year ago By dharmendr

Posted one year ago


i want when user click on submit button, button should disable and text should show as Progressing.....

Posted one year ago

Hi nauna,

Check this example. Now please take its reference and correct your code.


public class HomeController : Controller
    // GET: /Home/
    public ActionResult Index()
        return View();

    public ActionResult Save()
        // ... do something task
        ViewData["IsEnabled"] = false;
        return View("Index");


    <script type="text/javascript" src="https://code.jquery.com/jquery-2.2.3.js"></script>
    <script type="text/javascript">
        $(function () {
            var enabled = '<%= ViewData["IsEnabled"] %>'
            if (enabled == 'False') {
            $('#btnSave').on('click', function () {
                $(this).attr('disabled', 'disabled');
        <%using (Html.BeginForm("Save", "Home", FormMethod.Post))
        <input type="submit" id="btnSave" value="Save" />
        <% } %>