locked
Loading Progress RRS feed

  • Question

  • User-1499457942 posted

    Hi

       I have below code . I want when ddlprocess selected index changed fires then Show Progress function should get invoked.

    <asp:Content ID="Content2" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">
    
        <script type="text/javascript">
            function ShowProgress() {
                setTimeout(function () {
                    var modal = $('<div />');
                    modal.addClass("modal");
                    $('body').append(modal);
                    var loading = $(".loading");
                    loading.show();
                    var top = Math.max($(window).height() / 2 - loading[0].offsetHeight / 2, 0);
                    var left = Math.max($(window).width() / 2 - loading[0].offsetWidth / 2, 0);
                    loading.css({ top: top, left: left });
                }, 200);
            }
    
        </script>
    
    
        <div class="form-horizontal">
            <div class="form-group">
                <label for="Select" class="col-sm-4 control-label">Select</label>
                <div class="col-sm-4">
                    <asp:DropDownList ID="ddlProcess" runat="server" AutoPostBack="true"  OnSelectedIndexChanged="ddlProcess_SelectedIndexChanged" CssClass="btn btn-default btn-sm">
                </asp:DropDownList>
                </div>
            </div>
    
            <div id="dialog" style="display: none"> </div>
            <div class="loading" align="center" style="display: none"> 
                Loading. Please wait.<br />
                <br />
                <img src="Images/ajax-loader.gif" alt="" />
            </div>
        </div>
    </asp:Content>
    

    Thanks

    Monday, October 15, 2018 5:57 AM

All replies

  • User61956409 posted

    Hi JagjitSingh,

    I want when ddlprocess selected index changed fires then Show Progress function should get invoked.

    If you'd like to call JavaScript Client Side function from asp:DropDownList "ddlProcess" OnSelectedIndexChanged event, you can use:

    protected void ddlProcess_SelectedIndexChanged(object sender, EventArgs e)
    {
        //your code logic here
    
    
        string script = "ShowProgress()";
        ClientScript.RegisterStartupScript(this.GetType(), "showprogress", script, true);
    }

    With Regards,

    Fei Han

    Monday, October 15, 2018 6:26 AM
  • User-1499457942 posted

    Hi Fei Han

       I have written below code but not working

    protected void ddlProcess_SelectedIndexChanged(object sender, EventArgs e)
    {

    string script = "ShowProgress()";
    ClientScript.RegisterStartupScript(this.GetType(), "showprogress", script, true);
    Calculation();

    }

    Thanks

    Tuesday, October 16, 2018 10:01 AM
  • Tuesday, October 16, 2018 12:57 PM