当btnSubmit单击时会出现UpdateProgress,但是在我上传图像后第二次出现UpdateProgress。如果我没有上传图像,则会显示“更新进度”。而且我在图片上传后第二次发现 ContentPlaceHolder1_updProgress 从控制台中消失了。否则(第二次没有上传图片) ContentPlaceHolder1_updProgress 在控制台中。所以我认为问题在于第二次上传图片。在我第一次点击时,每件事都没问题。
我的Aspx
<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:UpdatePanel ID="UpdatePanel3" runat="server">
<Triggers>
<asp:PostBackTrigger ControlID="btnUpload" />
</Triggers>
<ContentTemplate>
<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="btnUpload_Click" />
<% 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>
</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>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnSubmit" EventName="Click" />
</Triggers>
<ContentTemplate>
<div class="form-group row">
<div class="col-sm-6">
<div class="col-sm-6">
<asp:Button ID="btnSubmit" OnClick="btnSubmit_Click"
CssClass="btn btn-primary" OnClientClick="javascript:return btnSubmit();"
runat="server" Text="Submit" AutoPostBack="true" />
<a href="assignment.aspx?sid=<%=Request.QueryString["sid"] %>" class="btn btn-default">Cancel</a>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
背后的代码
protected void btnSubmit_Click(object sender, EventArgs e)
{
updProgress.Visible = true;
SendEmail(Convert.ToInt32(drpDiv.Text));
updProgress.Visible = false;
}
可能这是一个重复的问题,但我需要解决我的问题
答案 0 :(得分:-1)
从
背后的代码中删除它updProgress.Visible = true;
updProgress.Visible = false;