<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>asp.net GridView Paging example: how to Paging GridView Data</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Fuchsia">Paging In GridView</h2>
<asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT ProductID, ProductName, UnitPrice FROM Products"
>
</asp:SqlDataSource>
<asp:GridView
ID="GridView1"
runat="server"
DataSourceID="SqlDataSource1"
AutoGenerateColumns="false"
BackColor="Snow"
ForeColor="DarkMagenta"
BorderColor="DimGray"
BorderStyle="Dotted"
BorderWidth="2"
AllowSorting="true"
AllowPaging="true"
PageSize="5"
>
<Columns>
<asp:BoundField SortExpression="ProductID" HeaderText="Product ID" DataField="ProductID" />
<asp:BoundField SortExpression="ProductName" HeaderText="Product Name" DataField="ProductName" />
<asp:BoundField SortExpression="UnitPrice" HeaderText="Unit Price" DataField="UnitPrice" />
</Columns>
</asp:GridView>
</div>
</form>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>asp.net GridView Paging example: how to Paging GridView Data</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Fuchsia">Paging In GridView</h2>
<asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT ProductID, ProductName, UnitPrice FROM Products"
>
</asp:SqlDataSource>
<asp:GridView
ID="GridView1"
runat="server"
DataSourceID="SqlDataSource1"
AutoGenerateColumns="false"
BackColor="Snow"
ForeColor="DarkMagenta"
BorderColor="DimGray"
BorderStyle="Dotted"
BorderWidth="2"
AllowSorting="true"
AllowPaging="true"
PageSize="5"
>
<Columns>
<asp:BoundField SortExpression="ProductID" HeaderText="Product ID" DataField="ProductID" />
<asp:BoundField SortExpression="ProductName" HeaderText="Product Name" DataField="ProductName" />
<asp:BoundField SortExpression="UnitPrice" HeaderText="Unit Price" DataField="UnitPrice" />
</Columns>
</asp:GridView>
</div>
</form>
</body>
</html>
No comments:
Post a Comment