我在.ascx文件中有以下内容。
<asp:Panel runat="server" Height="200">
<div class="col50">
<div class="col100" style="padding-bottom: 4px; float: left">
<div class="col50">
<asp:Label ID="Label13" runat="server" Text="Fee Split">
</asp:Label>
</div>
<div class="col50">
<asp:CheckBox ID="IsFeeSplitCheck" Enabled="false"
runat="server" />
</div>
</div>
<div class="col100" style="padding-bottom: 4px; float: left">
<div class="col50">
<asp:Label ID="Label12" runat="server" Text="R"></asp:Label>
</div>
<div class="col50">
</div>
</div>
<div class="col100" style="padding-bottom: 4px; float: left">
<div class="col50" style="text-align: left;">
<asp:Label ID="lblLogo" runat="server" Text="Practice Logo">
</asp:Label>
</div>
<div class="col50">
<asp:FileUpload ID="fuCompanyLogo"
ViewStateMode="Enabled" Enabled="true" runat="server" />
</div>
</div>
</div>
<div class="col100" style="padding-bottom: 4px; float: left">
<div class="col25">
<asp:Label ID="Label11" runat="server" Text=" "></asp:Label>
</div>
<div class="col75">
<asp:CheckBox ID="chkAssetAllocation" Font-Bold="true"
AutoPostBack="false" runat="server" Text="D"/>
</div>
</div>
</asp:Panel>
无论我上传多少次,FileUpload的“HasFile”总是会返回。并且,同时文件名始终为空字符串。
有人能解决这个问题吗?
答案 0 :(得分:1)
<asp:UpdatePanel id="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Panel id="popup" visible="false" runat="server" BackColor="#9AD6E4" BorderColor="#2F99BA" style="border-radius: 0.30em;"
Width="580px" BorderStyle="Solid" BorderWidth="2px">
<br />
<div style="text-align: center; font-style:italic; font-size: small; font-weight:bold;" ><asp:Label ID="TitleLabel" runat="server" Text=""></asp:Label> </div>
<asp:Label ID="LabMSG" runat="server" Text="" ForeColor="Red"></asp:Label>
<table style="background-color: #9AD6E4; padding: 5px">
<tr>
<td><asp:Label ID="LabelA1" runat="server" Text="To:"></asp:Label></td>
<td><asp:TextBox ID="TextTO" runat="server" MaxLength="50" width="20em"></asp:TextBox></td>
<asp:RequiredFieldValidator ID="RFCN00" runat="server" ForeColor="Red" ErrorMessage="*"
Display="Dynamic" ValidationGroup="Add" ControlToValidate="TextTO">To: Required
</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="valEmailTo" runat="server" ErrorMessage="Invalid To: email. "
ControlToValidate="TextTO" ValidationExpression="^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$" />
</tr>
<tr>
<td><asp:Label ID="LabelA2" runat="server" Text="CC:"></asp:Label></td>
<td><asp:TextBox ID="TextCC" runat="server" MaxLength="50" width="20em"></asp:TextBox></td>
<asp:RegularExpressionValidator ID="valEmailCC" runat="server" ErrorMessage="Invalid CC: email."
ControlToValidate="TextCC" ValidationExpression="^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$" />
</tr>
<tr>
<td><asp:Label ID="Label17" runat="server" Text="Subject:"></asp:Label></td>
<td><asp:Label ID="wSubjct" runat="server"></asp:Label></td>
</tr>
<tr>
<td>
<asp:Label ID="LabelAttachFile" runat="server" Text="Attach File:"></asp:Label></td>
<td>
<asp:FileUpload ID="FileUpload1" runat="server" Width="25em" />
</td>
</tr>
</table>
<table>
<tr>
<td class="auto-style2">
<asp:Button CssClass="button" ID="btSend" runat="server" Text="Send eMail" OnClick="Send_Click" />
</td>
</tr>
</table>
<table>
<tr><td>
<asp:TextBox ID="TextToEdit" runat="server" MaxLength="180" width="48em" TextMode="Multiline" rows="3" Visible="false" ></asp:TextBox>
</td></tr>
</table>
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btSend" />
</Triggers>
</asp:UpdatePanel>