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

📄 listbooksbycategory.aspx

📁 一个网上书店的源码
💻 ASPX
字号:
<%@ Page Language="C#" MasterPageFile="~/Admin/admin.master" AutoEventWireup="true" CodeFile="ListBooksByCategory.aspx.cs" Inherits="Admin_ListBooksByCategory" Title="图书分类管理|第三波+书店" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphAdmin" Runat="Server">   
<script language="javascript">
function GetAllCheckBox(CheckAll)
{
 var items = document.getElementsByTagName("input");     
 for(i=0; i<items.length;i++)
 {       
   if(items[i].type=="checkbox")
   {
        items[i].checked = CheckAll.checked;
   }
 }
}
</script>
<div style="font-size:small">
    <asp:GridView runat="server" ID="gvBooks" AutoGenerateColumns="False" DataSourceID="odsBooks" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Vertical" Width="98%" OnRowDataBound="gvBooks_RowDataBound" AllowPaging="True">
        <Columns>
            <asp:TemplateField HeaderText="全选">
                <ItemTemplate>
                    <asp:CheckBox runat="server" ID="chbSelect" />
                </ItemTemplate>
                <EditItemTemplate>
                    &nbsp;
                </EditItemTemplate>
                <HeaderTemplate>
                    &nbsp;<input id="cbAll" type="checkbox" onclick="GetAllCheckBox(this)" />全选
                </HeaderTemplate>
                <ControlStyle Width="50px" />
            </asp:TemplateField>
            <asp:TemplateField Visible="False">
                <ItemTemplate>
                    <asp:Label ID="lblId" runat="server" Text='<%# Bind("Id") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Title" HeaderText="书名"/>
            <asp:TemplateField HeaderText="类别">               
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("Category.Name") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:HyperLinkField DataNavigateUrlFields="id" DataNavigateUrlFormatString="BookDetail.aspx?id={0}"
                HeaderText="详细" Text="查看">
                <ControlStyle Width="50px" />
            </asp:HyperLinkField>
        </Columns>       
        <FooterStyle BackColor="#CCCC99" />
        <RowStyle BackColor="#F7F7DE" />
        <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
        <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
    
     将选中书归入:
    <asp:DropDownList ID="ddlCatagory" runat="server" DataSourceID="odsCategories" DataTextField="Name" DataValueField="Id">
    </asp:DropDownList>
    <asp:Button runat="server" ID="btnModify" Text="修改" OnClick="btnModify_Click"/>
</div>
    <asp:ObjectDataSource ID="odsBooks" runat="server" SelectMethod="GetAllBooks"
        TypeName="MyBookShop.BLL.BookManager"></asp:ObjectDataSource>
    <asp:ObjectDataSource ID="odsCategories" runat="server" SelectMethod="GetAllCategories"
        TypeName="MyBookShop.BLL.CategoryManager"></asp:ObjectDataSource>
</asp:Content>

⌨️ 快捷键说明

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