C# 在asp.net应用程序中上载文件
我在asp.net应用程序中使用UploadFile时遇到问题:C# 在asp.net应用程序中上载文件,c#,asp.net,.net,file,file-upload,C#,Asp.net,.net,File,File Upload,我在asp.net应用程序中使用UploadFile时遇到问题: <%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Espace/Sous.master" CodeBehind="Info.aspx.cs" Inherits="Espace.Info1" %> <asp:Content ID="Content1" ContentPlaceHolderID="ChildContent2" runat="
<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Espace/Sous.master" CodeBehind="Info.aspx.cs" Inherits="Espace.Info1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ChildContent2" runat="server">
<div class="span9">
<div class="divpere">
<div class="divfille1">
<label>Télécharger votre CV (*)</label></div>
<div class="divfille2">
<asp:FileUpload ID="cvpath" runat="server" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator13" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="cvpath" Text="Champ obligatoire" ForeColor="Red"></asp:RequiredFieldValidator>
</div>
</div>
<div class="divpere">
<div class="divfille1"></div>
<div class="divfille2">
<asp:Button Style="color: #FFFFFF; background-color: #B81C22; margin-left: 73%" runat="server" ID="btn" Text="Modifier mes informations" OnClick="Valider" />
</div>
</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function () {
$("input[id*='pick']").datepicker({ dateFormat: 'dd/mm/yy' });
});
</script>
</asp:Content>
问题是,即使我选择了一个文件,this.cvpath.HasFile
也总是取false
您正在使用
更新面板吗?
?我尝试了您的代码。如果我需要查看您的aspx页面的其余部分,它工作得很好。@RickS请查看我的编辑您的母版页如何。我们也能看到吗?
protected void Valider(object sender, System.EventArgs e)
{
if (this.cvpath.HasFile)
{
}
}