⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adminbookmanger.aspx

📁 完成一个网上书店系统
💻 ASPX
字号:
<%@ Page Language="C#" MasterPageFile="~/Admin.master" AutoEventWireup="true" CodeFile="AdminBookManger.aspx.cs" Inherits="AdminBookManger" Title="无标题页" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .style22
        {
            width: 903px;
        }
        .style23
        {
            width: 148px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <table style="width:100%;">
        <tr>
            <td class="style23">
                &nbsp;</td>
            <td class="style22">
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td colspan="3">
                <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                    AllowSorting="True" AutoGenerateColumns="False" BackColor="White" 
                    BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" 
                    DataKeyNames="BookID" DataSourceID="SqlDataSource1" GridLines="Vertical" 
                    style="margin-right: 89px" Width="1147px">
                    <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
                    <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
                    <Columns>
                        <asp:CommandField HeaderText="编辑" ShowDeleteButton="True" 
                            ShowEditButton="True" />
                        <asp:BoundField DataField="BookID" HeaderText="书号" ReadOnly="True" 
                            SortExpression="BookID">
                            <ControlStyle Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="CatID" HeaderText="类别号" SortExpression="CatID">
                            <ControlStyle Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="BookName" HeaderText="书名" SortExpression="BookName">
                            <ControlStyle Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="BookMarketPrice" DataFormatString="{0:c}" 
                            HeaderText="市场价" HtmlEncode="False" SortExpression="BookMarketPrice">
                            <ControlStyle Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="BookPrice" DataFormatString="{0:c}" HeaderText="折扣价" 
                            HtmlEncode="False" SortExpression="BookPrice">
                            <ControlStyle Width="80px" />
                        </asp:BoundField>
                        <asp:TemplateField HeaderText="详细信息" SortExpression="BookInfo">
                            <EditItemTemplate>
                                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("BookInfo") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="Label1" runat="server" 
                                    Text='<%# (Eval("BookInfo")).ToString().Substring(0,6) %>'></asp:Label>
                            </ItemTemplate>
                            <ControlStyle Width="80px" />
                        </asp:TemplateField>
                        <asp:BoundField DataField="BookAmount" HeaderText="书本数量" 
                            SortExpression="BookAmount">
                            <ControlStyle Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Pree" HeaderText="出版社" SortExpression="Pree">
                            <ControlStyle Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Writer" HeaderText="作者" SortExpression="Writer">
                            <ControlStyle Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="ISBN" HeaderText="ISBN" SortExpression="ISBN">
                            <ControlStyle Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="PreeTime" DataFormatString="{0:d}" HeaderText="出版时间" 
                            HtmlEncode="False" SortExpression="PreeTime">
                            <ControlStyle Width="80px" />
                        </asp:BoundField>
                        <asp:ImageField DataImageUrlField="BookImage" HeaderText="图片">
                        </asp:ImageField>
                    </Columns>
                    <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
                    <AlternatingRowStyle BackColor="#DCDCDC" />
                </asp:GridView>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:BookShopConnectionString %>" 
                    DeleteCommand="DELETE FROM [Books] WHERE [BookID] = @BookID" 
                    InsertCommand="INSERT INTO [Books] ([BookID], [CatID], [BookName], [BookImage], [BookMarketPrice], [BookPrice], [BookInfo], [BookAmount], [Pree], [Writer], [ISBN], [PreeTime]) VALUES (@BookID, @CatID, @BookName, @BookImage, @BookMarketPrice, @BookPrice, @BookInfo, @BookAmount, @Pree, @Writer, @ISBN, @PreeTime)" 
                    SelectCommand="SELECT * FROM [Books]" 
                    UpdateCommand="UPDATE [Books] SET [CatID] = @CatID, [BookName] = @BookName, [BookImage] = @BookImage, [BookMarketPrice] = @BookMarketPrice, [BookPrice] = @BookPrice, [BookInfo] = @BookInfo, [BookAmount] = @BookAmount, [Pree] = @Pree, [Writer] = @Writer, [ISBN] = @ISBN, [PreeTime] = @PreeTime WHERE [BookID] = @BookID">
                    <DeleteParameters>
                        <asp:Parameter Name="BookID" Type="Int32" />
                    </DeleteParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="CatID" Type="Int32" />
                        <asp:Parameter Name="BookName" Type="String" />
                        <asp:Parameter Name="BookImage" Type="String" />
                        <asp:Parameter Name="BookMarketPrice" Type="Decimal" />
                        <asp:Parameter Name="BookPrice" Type="Decimal" />
                        <asp:Parameter Name="BookInfo" Type="String" />
                        <asp:Parameter Name="BookAmount" Type="Int32" />
                        <asp:Parameter Name="Pree" Type="String" />
                        <asp:Parameter Name="Writer" Type="String" />
                        <asp:Parameter Name="ISBN" Type="String" />
                        <asp:Parameter Name="PreeTime" Type="DateTime" />
                        <asp:Parameter Name="BookID" Type="Int32" />
                    </UpdateParameters>
                    <InsertParameters>
                        <asp:Parameter Name="BookID" Type="Int32" />
                        <asp:Parameter Name="CatID" Type="Int32" />
                        <asp:Parameter Name="BookName" Type="String" />
                        <asp:Parameter Name="BookImage" Type="String" />
                        <asp:Parameter Name="BookMarketPrice" Type="Decimal" />
                        <asp:Parameter Name="BookPrice" Type="Decimal" />
                        <asp:Parameter Name="BookInfo" Type="String" />
                        <asp:Parameter Name="BookAmount" Type="Int32" />
                        <asp:Parameter Name="Pree" Type="String" />
                        <asp:Parameter Name="Writer" Type="String" />
                        <asp:Parameter Name="ISBN" Type="String" />
                        <asp:Parameter Name="PreeTime" Type="DateTime" />
                    </InsertParameters>
                </asp:SqlDataSource>
            </td>
        </tr>
        <tr>
            <td class="style23">
                &nbsp;</td>
            <td class="style22" align=center>
                <asp:Button ID="Button1" runat="server" Text="添加书籍" onclick="Button1_Click" />
            </td>
            <td>
                &nbsp;</td>
        </tr>
    </table>
&nbsp;
</asp:Content>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -