Click here to Skip to main content
15,895,192 members
Articles / Web Development / ASP.NET

Generic Paging for Recordset with Next Back Navigation

Rate me:
Please Sign up or sign in to vote.
3.55/5 (5 votes)
20 Jun 2005CPOL1 min read 32.6K   582   29  
This article is basically about a Paging control required for project purposes. One can use this just by changing three parameters.
<%@ OutputCache Duration=3 Location="Client" VaryByCustom="browser VaryByParam="None"%>
<%@ Page language="c#" Codebehind="PagingWithData.aspx.cs" AutoEventWireup="false" Inherits="Paging.WebForm3" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>WebForm1</title>
		<LINK href="../styles/styles.css" rel="STYLESHEET" type="text/css">
		</STYLE>
		<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
		<meta name="CODE_LANGUAGE" Content="C#">
		<meta name="vs_defaultClientScript" content="JavaScript">
		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
		<script language="JavaScript">
		function addDays(myDate,days) 
		{
			//return new Date(myDate.getTime() + days*24*60*60*1000);
			myDate.setDate(myDate.getDate()+days);
			return myDate;
		}
		function OpenNewWin()
		{
			alert("Open Window PleaseS");
			window.open('Basic.aspx','Asset','width=350,height=400,left=270,top=180,scrollbars=yes');
			return true;
		}
			
		
		</script>
	</HEAD>
	<body MS_POSITIONING="GridLayout">
		<form id="Form1" method="post" runat="server">
			<TABLE id="Table2" style="Z-INDEX: 101; LEFT: 96px; WIDTH: 312px; POSITION: absolute; TOP: 72px; HEIGHT: 224px"
				cellSpacing="1" cellPadding="1" width="312" border="1">
				<TR>
					<TD style="WIDTH: 110px"><STRONG>Total Record</STRONG></TD>
					<TD style="WIDTH: 63px">&nbsp;<STRONG>Select</STRONG></TD>
					<TD style="WIDTH: 256px">
						<asp:DropDownList id="ddlTotalRec" runat="server" Width="216px" AutoPostBack="True">
							<asp:ListItem Value="100">SELECT CustomerID, CompanyName FROM Customers</asp:ListItem>
							<asp:ListItem Value="200">Select CategoryID,CategoryName from Categories</asp:ListItem>
							<asp:ListItem Value="300">Select EmployeeID,LastName from Employees</asp:ListItem>
						</asp:DropDownList></TD>
					<TD style="WIDTH: 34px">&nbsp;</TD>
					<TD></TD>
				</TR>
				<TR>
					<TD style="WIDTH: 110px"><STRONG>Records</STRONG></TD>
					<TD style="WIDTH: 63px"><STRONG>&nbsp;Table</STRONG></TD>
					<TD style="WIDTH: 256px">
						<asp:Table id="tblRecordset" runat="server"></asp:Table></TD>
					<TD style="WIDTH: 34px">&nbsp;</TD>
					<TD>&nbsp;<STRONG>&nbsp;&nbsp;</STRONG> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
				</TR>
				<TR>
					<TD style="WIDTH: 110px; HEIGHT: 42px">&nbsp;&nbsp;
						<asp:Button id="btnFirstRec" runat="server" Text="<"></asp:Button></TD>
					<TD style="WIDTH: 63px; HEIGHT: 42px">&nbsp;&nbsp;
						<asp:Button id="btnPrev" runat="server" Text="<<"></asp:Button>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					</TD>
					<TD style="WIDTH: 256px; HEIGHT: 42px">
						<asp:Table id="tblPaging" runat="server" cellspacing="0" Runat="server"></asp:Table></TD>
					<TD style="WIDTH: 34px; HEIGHT: 42px">&nbsp;&nbsp;
						<asp:Button id="btnNext" runat="server" Text=">>"></asp:Button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					</TD>
					<TD style="HEIGHT: 42px">&nbsp;
						<asp:Button id="btnLastRec" runat="server" Text=">"></asp:Button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
				</TR>
				<TR>
					<TD style="WIDTH: 110px"><STRONG>First</STRONG></TD>
					<TD style="WIDTH: 63px"><STRONG>Previous</STRONG></TD>
					<TD style="WIDTH: 256px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<STRONG>Pagination</STRONG></TD>
					<TD style="WIDTH: 34px"><STRONG>Next</STRONG></TD>
					<TD><STRONG>Last</STRONG></TD>
				</TR>
			</TABLE>
			<asp:Label id="Label3" style="Z-INDEX: 102; LEFT: 264px; POSITION: absolute; TOP: 16px" runat="server"
				Width="329px" Font-Bold="True">Paging With Intervals</asp:Label>
			<asp:Label id="Label1" style="Z-INDEX: 104; LEFT: 96px; POSITION: absolute; TOP: 48px" runat="server"
				Width="214px" Height="7px">Label</asp:Label>
		</form>
	</body>
</HTML>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead
Australia Australia
Whatsup-->Exploring--> MVC/HTML5/Javascript & Virtualization.......!
www.santoshpoojari.blogspot.com

Comments and Discussions