1using System;
2using System.Data;
3using System.Web.UI;
4using System.Web.UI.WebControls;
5using Microsoft.Practices.EnterpriseLibrary.Data;
6
7public partial class Upload_ListControl : System.Web.UI.UserControl
8...{
9 protected void Page_Load(object sender, EventArgs e)
10 ...{
11 if (!Page.IsPostBack)
12 ...{
13 DisplayData(); // 처음 로드시에만 리스트 출력
14 }
15 }
16 private void DisplayData()
17 ...{
18 // 출력 패턴에 따른 데이터 출력
19 this.ctlUploadList.DataSource =
20 DatabaseFactory.CreateDatabase(
21 "ConnectionString").ExecuteDataSet(
22 CommandType.StoredProcedure
23 , "ListUpload");
24 this.ctlUploadList.DataBind(); // 출력
25 }
26 protected void btnWrite_Click(object sender, EventArgs e)
27 ...{
28 Response.Redirect("Write.aspx"); // 글쓰기 페이지로 이동
29 }
30 protected void ctlUploadList_PageIndexChanging(
31 object sender, GridViewPageEventArgs e)
32 ...{
33 ctlUploadList.PageIndex = e.NewPageIndex;
34 DisplayData(); // 새롭게 정의된 페이지에 해당하는 리스트
35 }
36 protected void btnSearch_Click(object sender, EventArgs e)
37 ...{
38 Response.Redirect(
39 String.Format(
40 "Search.aspx?SearchField={0}&SearchQuery={1}"
41 , SearchField.SelectedValue
42 , SearchQuery.Text));
43 }
44}
45