example..in VB..sorry but ahould be simple to convert to c#
Code:
<asp:DataGrid id="gridCorpList" runat="server" AllowPaging="True" OnPageIndexChanged="gridCorpList_Page" Width="100%" PageSize="5" ShowHeader="False" GridLines="None">
<PagerStyle mode="NumericPages"></PagerStyle>
</asp:DataGrid>
Code:
Sub gridCorpList_Page(source As Object, e As DataGridPageChangedEventArgs)
gridCorpList.CurrentPageIndex = e.NewPageIndex
strSQL= "Select Corp_Name FROM Corporations Where id <> 1 ORDER BY Corp_Name"
myConn = New OleDbConnection (strConnString)
' Populate the Dataset from the SQL statement
' Run the Sql statement and get the Data into the DataAdapter
myCommand = New OleDbDataAdapter(strSQL, myConn)
' Fill the DataSet and name the table
myCommand.Fill(myDS, "Corp")
myConn.Close()
gridCorpList.DataSource = myDS.Tables("Corp").DefaultView
gridCorpList.DataBind()
End Sub