日期:2014-05-17 浏览次数:20561 次
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FileUpload.aspx.cs" Inherits="FileUpload" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script type="text/javascript"> function show() { alert("图片格式错误~!"); } </script> </head> <body> <form id="form1" runat="server"> <asp:Label ID="lblImageFile" Text="Image File:" AssociatedControlID="upImage" runat="server" /> <asp:FileUpload ID="upImage" runat="server" /> <asp:Button ID="btnAdd" runat="server" Text="Add Image" OnClick="btnAdd_Click"/> <div> </div> <div style=" text-align:center;"> <asp:DataList ID="dlstImages" runat="server" RepeatColumns="4" HorizontalAlign="Center"> <ItemTemplate> <asp:Image ID="Image1" ImageUrl='<%# Eval("Name","~/UserImage1/{0}") %>' style="width:200px" Runat="server" /> <hr /> <%# Eval("Name") %> <hr /> </ItemTemplate> </asp:DataList> </div> </form> </body> </html>