UpdateProgress没有处理secound点击

时间:2017-09-12 05:05:53

标签: c# asp.net updatepanel updateprogress

UpdateProgress在首次点击按钮时效果很好。但是,当我第二次点击时,UpdateProgress没有出现。而不是UpdateProgress,所有东西在第二次点击时效果都很好。请帮帮我..

   <asp:UpdatePanel ID="UpdatePanel2" runat="server">
   <Triggers>
       <asp:AsyncPostBackTrigger ControlID="btnSubmit" />
    </Triggers>
    <ContentTemplate>
        <div class="form-group row">
            <div class="col-sm-6">
                <p style="margin: 0 0 5px 0;"><b>Class</b></p>
                <asp:DropDownList ID="drpClass" CssClass="form-control" OnSelectedIndexChanged="drpClass_SelectedIndexChanged" AutoPostBack="true" runat="server"></asp:DropDownList>
            </div>
            <div class="col-sm-6">
                <p style="margin: 0 0 5px 0;"><b>Division</b></p>
                <asp:DropDownList ID="drpDiv" CssClass="form-control"
                    runat="server">
                </asp:DropDownList>
            </div>
        </div>
        <div class="form-group row">
            <div class="col-sm-6">
                <p style="margin: 0 0 5px 0;"><b>Date</b></p>
                <asp:TextBox runat="server" ID="txtDateGiven" CssClass="form-control"
                    placeholder="Select a Date"></asp:TextBox>
                <asp:CalendarExtender ID="CalendarExtender2" runat="server" Format="dd/MMM/yyyy" PopupButtonID="txtDateGiven"
                    TargetControlID="txtDateGiven">
                </asp:CalendarExtender>
            </div>

            <div class="col-sm-6">
                <p style="margin: 0 0 5px 0;"><b>Date of Submission</b></p>
                <asp:TextBox runat="server" ID="txtDateSubmit" CssClass="form-control"
                    placeholder="Select a Date"></asp:TextBox>
                <asp:CalendarExtender ID="CalendarExtender1" runat="server" Format="dd/MMM/yyyy" PopupButtonID="txtDateSubmit"
                    TargetControlID="txtDateSubmit">
                </asp:CalendarExtender>
            </div>
        </div>

        <div class="form-group row">
            <div class="col-sm-12">
                <p style="margin: 0 0 5px 0;"><b>Subject</b></p>
                <asp:DropDownList ID="drpSubject" CssClass="form-control" runat="server"></asp:DropDownList>
            </div>
        </div>
        <div class="form-group row">
            <div class="col-sm-12">
                <p style="margin: 0 0 5px 0;"><b>Type</b></p>
                <asp:DropDownList ID="drpAssignmentType" CssClass="form-control" runat="server"></asp:DropDownList>
            </div>
        </div>
        <div class="form-group row">
            <div class="col-sm-12">
                <p style="margin: 0 0 5px 0;"><b>Title</b></p>
                <asp:TextBox ID="txtAssignmentTitle" CssClass="form-control" placeholder="Enter Title"
                    runat="server"></asp:TextBox>
            </div>
        </div>
        <div class="form-group row">
            <div class="col-sm-12">
                <p style="margin: 0 0 5px 0;"><b>Description</b></p>
                <asp:TextBox ID="txtAssignmentDes" CssClass="form-control" TextMode="MultiLine" Height="250"
                    placeholder="Enter Description"
                    runat="server"></asp:TextBox>
            </div>
        </div>
    </ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="updProgress"
    AssociatedUpdatePanelID="UpdatePanel1"
    runat="server">
    <ProgressTemplate>
        <div class="modal">
            <div class="center">
                <span style="padding-left: 10px"><b>Please Wait..</b></span>
                <img alt="" src="../images/Preloader_3.gif" width="50" height="50" />
            </div>
        </div>
    </ProgressTemplate>
</asp:UpdateProgress>
<div class="form-group row">
    <div class="col-sm-6">
        <p style="margin: 0 0 5px 0;"><b>Upload File</b></p>
        <asp:FileUpload ID="imgPhoto" runat="server" />
        <br />
        <asp:Button ID="btnUpload" Text="Upload" runat="server" OnClick="Upload" Style="display: none" />
        <% if (ViewState["Image"] != null)
           {%>
        <a target="_blank" href="<%=ViewState["ImageName"]%>">View Attachment</a>
        <%}
           else
           { %>
        <asp:Label ID="Label1" runat="server" ForeColor="Red" Text="No File Uploaded"></asp:Label>
        <%} %>
    </div>
</div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <div class="form-group row">
            <div class="col-sm-6">
                <div class="col-sm-6">
                    <asp:Button ID="btnSubmit" OnClick="btnSubmit_Click"
                        OnClientClick="javascript:return btnSubmit();" CssClass="btn btn-primary"
                        runat="server" Text="Submit" />
                    <a href="assignment.aspx?sid=<%=Request.QueryString["sid"] %>" class="btn btn-default">Cancel</a>
                </div>
            </div>
        </div>
    </ContentTemplate>
</asp:UpdatePanel>

背后的代码

updProgress.Visible = true;
SendEmail(Convert.ToInt32(drpDiv.Text));
updProgress.Visible = false;
txtAssignmentTitle.Text = "";
txtAssignmentDes.Text = "";
txtDateGiven.Text = "";
txtDateSubmit.Text = "";
ViewState["Image"] = null;
ViewState["ImageName"] = null;
drpAssignmentType.Items.Clear();
drpClass.Items.Clear();
drpDiv.Items.Clear();
drpSubject.Items.Clear();
drpSubject.Items.Insert(0, new ListItem("--Select--", "0"));
drpAssignmentType.Items.Insert(0, new ListItem("--Select--", "0"));
LoadClass();
LoadClassAndAssignmentType();
drpDiv.Items.Insert(0, new ListItem("--Select--", "0"));

我正在使用更新面板以避免页面加载。如果我尝试使用response.redirect重新加载页面,则不会出现UpdateProgress。请帮帮我..

0 个答案:

没有答案