在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
最近捣鼓了一下,效果就是这样:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ImageFileUpload.aspx.cs" Inherits="ImageFileUpload" %> <!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> </head> <body> <form id="Form2" enctype="multipart/form-data" runat="server"> <asp:Table ID="Table1" Runat="server" Width="39%" BorderWidth="1" BackColor="Beige"> <asp:TableRow runat="server"> <asp:TableCell ColumnSpan="2" BackColor="Red" runat="server"> <asp:Label ID="Label1" Font-size="12px" ForeColor="White" font-bold="True" Runat="server" Text="添加" Font-Names="verdana" /> </asp:TableCell> </asp:TableRow> <asp:TableRow runat="server"> <asp:TableCell HorizontalAlign="Right" runat="server"><asp:Label ID="Label2" Font-size="12px" Runat="server" Text="名字" Font-Names="verdana" /></asp:TableCell> <asp:TableCell runat="server"><asp:TextBox id="txtPersonName" Runat="server" /></asp:TableCell> </asp:TableRow> <asp:TableRow runat="server"> <asp:TableCell HorizontalAlign="Right" runat="server"><asp:Label ID="Label3" Font-size="12px" Runat="server" Text="Email" Font-Names="verdana" /></asp:TableCell> <asp:TableCell runat="server"><asp:TextBox id="txtPersonEmail" Runat="server" /></asp:TableCell> </asp:TableRow> <asp:TableRow runat="server"> <asp:TableCell HorizontalAlign="Right" runat="server"><asp:Label ID="Label4" Font-size="12px" Runat="server" Text="性别" Font-Names="verdana" /></asp:TableCell> <asp:TableCell runat="server"> <asp:RadioButton GroupName="sex" Font-Size="12px" Text="男性" ID="sexMale" Runat="server" Checked="true" /> <asp:RadioButton GroupName="sex" Font-Size="12px" Text="女性" ID="sexFeMale" Runat="server" /> </asp:TableCell> </asp:TableRow> <asp:TableRow runat="server"> <asp:TableCell HorizontalAlign="Right" runat="server"><asp:Label ID="Label5" Font-size="12px" Runat="server" Text="生日" Font-Names="verdana" /></asp:TableCell> <asp:TableCell runat="server"><asp:TextBox id="txtPersonDob" runat="server" /></asp:TableCell> </asp:TableRow> <asp:TableRow runat="server"> <asp:TableCell HorizontalAlign="Right" runat="server"><asp:Label ID="Label6" Font-size="12px" Runat="server" Text="图片" Font-Names="verdana" /></asp:TableCell> <asp:TableCell runat="server"><input type="file" id="PersonImage" runat="server" /></asp:TableCell> </asp:TableRow> <asp:TableRow runat="server"> <asp:TableCell ColumnSpan="2" HorizontalAlign="Center" runat="server"> <asp:Button ID="Button1" Text="添加" OnClick="AddPerson" runat="server" /> </asp:TableCell> </asp:TableRow> </asp:Table> <br /> <table> <tr> <td align="left" valign="top" style="width: 181px"> <asp:Label ID="Label_Message" runat="server" Font-Size="10pt"></asp:Label></td> <td style="width: 7px"> </td> <td align="left" style="width: 18px" valign="top"> </td> </tr> <tr> <td style="width: 181px;" align="left" valign="top"> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="PersonID" DataSourceID="SqlDataSource_SelectImage" ForeColor="#333333" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" Font-Size="10pt" Width="200px" BackColor="#FFE0C0"> <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /> <Columns> <asp:TemplateField HeaderText="序号" InsertVisible="False" SortExpression="PersonID"> <EditItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Eval("PersonID") %>'></asp:Label> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Bind("PersonID") %>'></asp:Label> </ItemTemplate> <HeaderStyle Width="35px" /> </asp:TemplateField> <asp:BoundField DataField="PersonName" HeaderText="名字" SortExpression="PersonName" /> <asp:BoundField DataField="PersonImageType" HeaderText="图片类型" SortExpression="PersonImageType" /> <asp:CommandField ShowSelectButton="True" > <ItemStyle Width="30px" /> </asp:CommandField> </Columns> <RowStyle BackColor="#EFF3FB" /> <EditRowStyle BackColor="#2461BF" /> <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" /> <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" /> <HeaderStyle BackColor="Red" Font-Bold="True" ForeColor="White" /> <AlternatingRowStyle BackColor="White" /> </asp:GridView> </td> <td style="width: 7px; height: 180px;"> </td> <td align="left" style="width: 18px; height: 180px;" valign="top"> <asp:Image ID="Image_Show" runat="server" /></td> </tr> <tr> <td style="width: 181px"> |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论