Search results

Change the text content and styles of the ProgressButton during progress in ASP.NET MVC ProgressButton control

30 Jul 2021 / 1 minute to read

You can change the text content and styles of the ProgressButton during progress state by changing the text content and the cssClass property at the begin and end events.

razor
default.cs
Copied to clipboard
@Html.EJS().ProgressButton("upload").Content("Upload").EnableProgress(true).CssClass("e-hide-spinner").Duration(4000).Begin("begin").End("end").Render()

<script>
    function begin() {
        this.content = 'Uploading...';
        this.cssClass = 'e-hide-spinner e-info';
        this.dataBind();
    }

    function end() {
        this.content = 'Success';
        this.cssClass = 'e-hide-spinner e-success';
        this.dataBind();
        setTimeout(() => {
            this.content = 'Upload';
            this.cssClass = 'e-hide-spinner';
            this.dataBind();
        }, 500)
    }
</script>
Copied to clipboard
public ActionResult Default()
{
        return View();
}