newsmanage.aspx

来自「microsoft公司在进行ASP.NET 2.0培训课时课堂操作演示代码。」· ASPX 代码 · 共 46 行

ASPX
46
字号
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="NewsManage.aspx.cs" Inherits="Admins_NewsManage" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <table border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td style="width: 213px; height: 11px">
                <img src="../images/1x1.gif" style="width: 139px; height: 1px" /></td>
            <td style="width: 100px; height: 11px">
            </td>
        </tr>
        <tr>
            <td style="width: 213px">
                新闻种类列表:</td>
            <td style="width: 100px">
                <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"
                    Width="144px">
                </asp:DropDownList></td>
        </tr>
        <tr>
            <td style="width: 213px; height: 19px">
                新闻列表:</td>
            <td style="width: 100px; height: 19px">
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Width="419px">
                    <Columns>
                        <asp:BoundField DataField="NewsId" HeaderText="序号" />
                        <asp:BoundField DataField="Title" HeaderText="标题" />
                        <asp:BoundField DataField="Pubdate" DataFormatString="{0:D}" HeaderText="发表日期" HtmlEncode="False" />
                        <asp:CommandField ShowDeleteButton="True" />
                        <asp:HyperLinkField DataNavigateUrlFields="NewsId" DataNavigateUrlFormatString="~/Admins/EditNews.aspx?NID={0}"
                            HeaderText="编辑" Text="编辑" />
                    </Columns>
                </asp:GridView>
            </td>
        </tr>
    </table>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NewsDBConnectionString %>"
        SelectCommand="SELECT * FROM [Categories]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:NewsDBConnectionString %>"
        SelectCommand="SELECT * FROM [NewsInfo] WHERE ([CategoryId] = @CategoryId) ORDER BY [Pubdate] DESC">
        <SelectParameters>
            <asp:ControlParameter ControlID="DropDownList1" Name="CategoryId" PropertyName="SelectedValue"
                Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
</asp:Content>

⌨️ 快捷键说明

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