1using System;
2using System.Web.UI;
3using System.Web.UI.WebControls;
4using Microsoft.Practices.EnterpriseLibrary.Data;
5
6public partial class Basic_SearchControl : System.Web.UI.UserControl
7...{
8 protected void Page_Load(object sender, EventArgs e)
9 ...{
10 if (!Page.IsPostBack) // 처음 로드시에만 출력
11 ...{
12 DisplayData();
13 }
14 }
15 private void DisplayData()
16 ...{
17 ctlSearchList.DataSource =
18 DatabaseFactory.CreateDatabase("ConnectionString").
19 ExecuteDataSet(
20 "SearchBasic",
21 Request["SearchField"],
22 Request["SearchQuery"]);
23 ctlSearchList.DataBind();
24 }
25 protected void btnList_Click(object sender, EventArgs e)
26 ...{
27 Response.Redirect("List.aspx");
28 }
29 protected void ctlSearchList_PageIndexChanging(
30 object sender, GridViewPageEventArgs e)
31 ...{
32 ctlSearchList.PageIndex = e.NewPageIndex; // 동일
33 DisplayData(); // 변경된 페이지에 해당하는 데이터 출력
34 }
35}
36