<ASP:DataGrid id="DataGrid1"runat="server"
AllowPaging="True"
PageSize="5"
PagerStyle-HorizontalAlign="Right"
BorderColor="black"
BordreWidth="1"
GridLines="Both"
CellPadding"3"
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaaadd"
AlternatingItemStyle=BackColor="#eeeeee"
/>
AllowPaging="True"
PageSize="5"
PagerStyle-HorizontalAlign="Right"
BorderColor="black"
BordreWidth="1"
GridLines="Both"
CellPadding"3"
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaaadd"
AlternatingItemStyle=BackColor="#eeeeee"
/>
private void Page_Load(object sender, System.EventArgs e)
{
…………
DataGrid1.DataSource = DataSet1.Tables[0].DefaultView;
//DataSet1为要绑定的结果集。
DataGrid1.DataBind();
}private void DataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
string sSQL, sUserID = "";
DataGrid1.DataSource = DataSet1.Tables[0].DefaultView;
DataGrid1.CurrentPageIndex = e.NewPageIndex;
DataGrid1.DataBind();
}