1<%...@ Control Language="C#" AutoEventWireup="true"
2 CodeFile="List.ascx.cs" Inherits="Basic_ListControl" %>
3<h3>글 목록h3>
4<div>
5<asp:GridView ID="ctlBasicList" runat="server"
6 AutoGenerateColumns="False" AllowPaging="True" PageSize="3"
7 OnPageIndexChanging="ctlBasicList_PageIndexChanging">
8 <Columns>
9 <asp:HyperLinkField
10 HeaderText="제 목"
11 DataTextField="Title"
12 DataNavigateUrlFields="Num"
13 DataNavigateUrlFormatString="View.aspx?Num={0}"
14 />
15 <asp:TemplateField HeaderText="작성자">
16 <ItemTemplate>
17 <%...# DataBinder.Eval(Container.DataItem, "Name") %>
18 ItemTemplate>
19 <AlternatingItemTemplate>
20 <%...# Eval("Name") %>
21 AlternatingItemTemplate>
22 asp:TemplateField>
23 <asp:BoundField HeaderText="작성일" DataField="PostDate"
24 DataFormatString="{0:yyyy-MM-dd}" HtmlEncode="False" />
25 <asp:BoundField HeaderText="조회수" DataField="ReadCount" />
26 Columns>
27asp:GridView>
28<br />
29
30검색:
31<asp:DropDownList ID="lstSearchField" runat="server">
32 <asp:ListItem Value="Name">이름asp:ListItem>
33 <asp:ListItem Value="Title" Selected="true">제목asp:ListItem>
34 <asp:ListItem Value="Content">내용asp:ListItem>
35asp:DropDownList>
36<asp:TextBox ID="txtSearchQuery" runat="server">asp:TextBox>
37<asp:Button ID="btnSearch" runat="server" Text="검색"
38 OnClick="btnSearch_Click" /><br />
39
40<asp:Button ID="btnWrite" runat="server" Text="글쓰기"
41 OnClick="btnWrite_Click" />
42div>