제목 : FrmGridView번호유지.aspx.cs
글번호:
|
|
316
|
작성자:
|
|
레드플러스
|
작성일:
|
|
2009/08/13 오후 7:27:00
|
조회수:
|
|
4164
|
using System;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Practices.EnterpriseLibrary.Data;
public partial class Qna_FrmGridView번호유지 : System.Web.UI.Page
{
public int intPage { get; set; }
public int intTotalCount { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
intTotalCount = Convert.ToInt32(DatabaseFactory.CreateDatabase("ConnectionString").ExecuteScalar(CommandType.Text, "Select Count(*) From PagingTest"));
if (!Page.IsPostBack)
{
DisplayData();
}
}
private void DisplayData()
{
this.GridView1.DataSource = DatabaseFactory.CreateDatabase("ConnectionString").ExecuteDataSet(CommandType.Text, "Select * From PagingTest Order By Num Desc");
this.GridView1.DataBind();
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
intPage = e.NewPageIndex;
this.GridView1.PageIndex = e.NewPageIndex;
DisplayData();
}
}