datagrid| to define the ASPX page first, note allowcustompaging to set to False:
<body>
<form id= "Dictlist" method= "POST" runat= "Server" >
<table style= "border-collapse:collapse" cellspacing= "0" width= "100%" border= "1" >
<TR>
<TD bgcolor= "#c0c000" > Information: <font face= "Arial" color= "#ffffff" > Data Maintenance </FONT>
</td>
</TR>
<tr>
<td><font face= "Song Body" ></FONT></td>
</tr>
<tr>
<td><asp:datagrid id= "Mydatagrid" runat= "Server" width= "100%" pagesize= "" "Allowpaging=" True " autogeneratecolumns= "False" datakeyfield= "Fdictid" >
<selecteditemstyle backcolor= "#FFC080" ></SelectedItemStyle>
<Columns>
<asp:buttoncolumn text= "Select" headertext= "Choose" commandname= "select" >
<itemstyle font-bold= "True" horizontalalign= "Center" ></ItemStyle>
</asp:ButtonColumn>
<asp:boundcolumn datafield= "Fdictid" sortexpression= "fdictid ASC" headertext= "identification number" >
</asp:BoundColumn>
<asp:boundcolumn datafield= "FNAMECN" sortexpression= "FNAMECN ASC" headertext= "name" >
</asp:BoundColumn>
<asp:boundcolumn datafield= "Fnameen" sortexpression= "fnameen ASC" headertext= "English name" >
</asp:BoundColumn>
<asp:boundcolumn datafield= "Fnote" sortexpression= "fnote ASC" headertext= "describe" >
</asp:BoundColumn>
</Columns>
<pagerstyle visible= "False" ></PagerStyle>
</asp:datagrid></td>
</tr>
</TABLE>
<table style= "border-collapse:collapse" cellspacing= "0" width= "100%" bgcolor= "#ff9966" border= "1" >
<TR>
<TD align= "right" ><asp:linkbutton id= "Btnfirst" runat= "Server" commandargument= "fist" > Home page </asp: Linkbutton>
<asp:linkbutton id= "Btnprev" runat= "Server" width= "36px" commandargument= "prev" > Prev </asp:linkbutton>
<asp:linkbutton id= "Btnnext" runat= "Server" commandargument= "Next" > Next </asp:linkbutton>
<asp:linkbutton id= "Btnlast" runat= "Server" commandargument= "last" > End </asp:linkbutton>
<asp:label id= "Lblcurrentindex" runat= "Server" ></asp:label>/<asp:label id= "LblPageCount" Server ></asp:label>
Jump to <asp:textbox id= "Txtgopage" runat= "Server" width= "30px" cssclass= "TextBox" ></asp:TextBox>
<asp:button id= "Btngo" runat= "server" text= "Go" cssclass= "button" width= "29px" ></asp:Button></td>
</TR>
</TABLE>
</form>
Codebehind main Function Part code:
private void Page_Load (object sender, System.EventArgs e)
{
Place user code here to initialize page
myconnection = new SqlConnection (system.configuration.configurationsettings.appsettings["ConnString"));
if (! IsPostBack)
Bindgrid ();
}
public void Bindgrid ()
{
String strSQL = "SELECT * from T_dict";
SqlDataAdapter mycommand = new SqlDataAdapter (strSQL, MyConnection);
DataSet ds = new DataSet ();
Mycommand.fill (ds, "t_dict");
Mydatagrid.datasource