protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
{
FileUpload file = (FileUpload)DataList1.FindControl("FileUpload1");
file.SaveAs(Request.MapPath("//") + "resume//");
}
这是数据主义者:
<asp:DataList ID="DataList1" runat="server" OnSelectedIndexChanged="DataList1_SelectedIndexChanged" OnItemCommand="DataList1_ItemCommand">
<ItemTemplate>
<div class="jumbotron">
<div class="card-primary">
<asp:LinkButton ID="job_pos" runat="server" Font-Size="XX-Large"><%#Eval ("JobPosition") %></asp:LinkButton>
<h4 style="font-weight: bolder"><%#Eval ("CompanyName") %> <span class="icon"><i class="fa fa-building"></i></span></h4>
<h5 style="font-weight: bold; color: #808080"><%#Eval ("Region") %> <span class="icon"><i class="fa fa-map-marker"></i></span></h5>
<h5 style="font-weight: bold; color: #808080"><%#Eval ("ExactAddress") %></h5>
<div>
<h5><%#Eval ("JobDesc") %></h5>
<div>
<asp:Label ID="Label2" runat="server" Text="Interested? Apply Now!" Font-Bold="True" ForeColor="Red"></asp:Label>
<asp:FileUpload ID="FileUpload1" runat="server" CssClass="primary"/>
<asp:Button ID="Button1" runat="server" Text="Upload Resume" OnClick="Button1_Click" CssClass="btn-primary" CommandName="UPDATE"/>
</div>
</div>
</div>
</div>
</ItemTemplate>
</asp:DataList>