Home
About
Contact
Categories
Classic ASP (28 - Sub-Categories)
CSS (1 - Sub-Category)
JavaScript (4 - Sub-Categories)
Databases (22 - Sub-Categories)
ASP.NET (23 - Sub-Categories)
Delphi (5 - Sub-Categories)
Windows Server Core (3 - Sub-Categories)
VMWare (1 - Sub-Category)
Code Editing Tools (2 - Sub-Categories)
Linux (2 - Sub-Categories)
Dell Servers (15 - Sub-Categories)
Bug Reports
(Bugs Fixed
New CFFCS Coding Source is still in Beta
Please report any errors to the [Contact] page. Thank you.
Classic ASP (28)
CSS (1)
JavaScript (4)
Databases (22)
ASP.NET (23)
Delphi (5)
Windows Server Core (3)
VMWare (1)
Code Editing Tools (2)
Linux (2)
Dell Servers (15)
Resources
[View The Source Code For This Project]
Format SQL Script
ASP.NET
C#
ASP.NET Column & Paging System with C#
HTML
<%# Eval("MyTitle") %>
[
]
CSS
body { font-family: Arial; font-size: 10pt; } .Item { height: 5px; width: 100%; /*Get the length of the longest word then duplicate for that column only.*/ margin: 0; } .Item, .Item td, .Item td { border: 1px solid #ccc; } .Item .header { color: Black; font-size: 10pt; line-height: 200%; } .page_disabled{ border: 1px double #000; background-color: #036; color: #FFF; padding: 4.5px; /*Make the selected number container larger then those around it.*/ font-size: 10pt; } .page_enabled, .page_disabled { display: inline-block; height: 25px; min-width: 25px; line-height: 25px; text-align: center; text-decoration: none; border: 1px solid #ccc; } .page_enabled { color: #000; } .page_disabled { color: #fff !important; }
SQL
Create Table and Generate Records
Stored Procedure
USE [Virtual-Class-01] GO /****** Object: Table [dbo].[Paging] Script Date: 9/19/2022 8:01:13 PM ******/ /*This is the shortlist, only 100 records instead of the giant list of 1,298 records.*/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[Paging]( [ID] [int] IDENTITY(1,1) NOT NULL, [MyTitle] [nvarchar](50) NOT NULL, CONSTRAINT [PK_Paging] PRIMARY KEY CLUSTERED ( [ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] GO SET IDENTITY_INSERT [dbo].[Paging] ON GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (1, N'MyTitles') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (2, N'Cycle') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (3, N'dame') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (4, N'Ethiopian') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (5, N'language') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (6, N'doomy') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (7, N'Smirk') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (8, N'unbacked') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (9, N'Vitrifacture') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (10, N'pellagra') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (11, N'Dunkirk') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (12, N'Smatch') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (13, N'interproximal') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (14, N'figurer') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (15, N'or38') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (16, N'texan') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (17, N'mispronunciation') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (18, N'shaddock') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (19, N'samiel') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (20, N'ascendable') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (21, N'Rushed') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (22, N'Cucumis') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (23, N'raccoon') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (24, N'dog') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (25, N'Sickleman') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (26, N'nt') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (27, N'Alabaster') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (28, N'pliant') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (29, N'photographer') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (30, N'Crotaphytus') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (31, N'venenosum') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (32, N'suborder') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (33, N'Passeres') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (34, N'prat') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (35, N'icing') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (36, N'sugar') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (37, N'across') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (38, N'Cant') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (39, N'cloud') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (40, N'forest') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (41, N'chigger') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (42, N'flower') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (43, N'unequivocally') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (44, N'To') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (45, N'blow') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (46, N'upon') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (47, N'off-hour') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (48, N'dies') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (49, N'irae') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (50, N'Melanism') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (51, N'claystone') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (52, N'Pearl') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (53, N'travelled') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (54, N'drinking') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (55, N'Bush') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (56, N'bean') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (57, N'63f') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (58, N'Goll') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (59, N'elemi') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (60, N'stonewalling') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (61, N'Signora') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (62, N'nepalese') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (63, N'Balaton') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (64, N'burn') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (65, N'mark') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (66, N'Ni-resist') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (67, N'Unworthy') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (68, N'distressing') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (69, N'Kraut') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (70, N'occidental') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (71, N'wall-paperer') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (72, N'VCR') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (73, N'ls') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (74, N'subalpine') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (75, N'fir') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (76, N'override') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (77, N'Nephridia') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (78, N'populate') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (79, N'Camphene') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (80, N'autofocus') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (81, N'fellfare') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (82, N'forces') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (83, N'obelize') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (84, N'Saltier') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (85, N'hoosac') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (86, N'mountain') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (87, N'lick') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (88, N'decembrist') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (89, N'refractively') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (90, N'underwool') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (91, N'Cyclopteridae') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (92, N'Haggada') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (93, N'Wrap') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (94, N'goal') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (95, N'line') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (96, N'polo,') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (97, N'marco') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (98, N'hame') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (99, N'gramme') GO INSERT [dbo].[Paging] ([ID], [MyTitle]) VALUES (100, N'sea') GO SET IDENTITY_INSERT [dbo].[Paging] OFF GO
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= CREATE PROCEDURE [dbo].[GetCustomersPageWise] @PageIndex INT = 1 ,@PageSize INT = 10 ,@RecordCount INT OUTPUT AS BEGIN SET NOCOUNT ON; SELECT ROW_NUMBER() OVER ( ORDER BY [ID] ASC )AS RowNumber ,[ID] ,[MyTitle] INTO #Results FROM [Paging] SELECT @RecordCount = COUNT(*) FROM #Results SELECT * FROM #Results WHERE RowNumber BETWEEN(@PageIndex -1) * @PageSize + 1 AND(((@PageIndex -1) * @PageSize + 1) + @PageSize) - 1 DROP TABLE #Results END
ASP.NET
Web.Config
database.Config
Load.aspx.vb
using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Configuration; // Needed for ConfigurationManager in connection string for database using System.Web.UI.WebControls; partial class Load : System.Web.UI.Page { private int PageSizes = 100; // Public Property CurrentPageNumbers As Object private int PageIndex { get { if (!string.IsNullOrEmpty(Request.QueryString["pageIndex"])) { return Convert.ToInt32(Request.QueryString["pageIndex"]); } else { return 0; } } } private int PageSize { get { if (!string.IsNullOrEmpty(Request.QueryString["pageSize"])) { return Convert.ToInt32(Request.QueryString["pageSize"]); } else { return 4; } } } private int PageCount { get { if (TotalRowCount <= 0 || PageSize <= 0) { return 1; } else { return (int)Math.Round((TotalRowCount + PageSize - 1) / (double)PageSize); } } } public Load() { this.Load += Page_Load; } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { GetCustomersPageWise(1); } } private void GetCustomersPageWise(int pageIndex) { string constr = ConfigurationManager.ConnectionStrings["Virtual-Learning"].ConnectionString; using (var con = new SqlConnection(constr)) { using (var cmd = new SqlCommand("GetCustomersPageWise", con)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@PageIndex", pageIndex); cmd.Parameters.AddWithValue("@PageSize", PageSizes); cmd.Parameters.Add("@RecordCount", SqlDbType.Int, 4); cmd.Parameters["@RecordCount"].Direction = ParameterDirection.Output; con.Open(); IDataReader idr = cmd.ExecuteReader(); dlCustomers.DataSource = idr; dlCustomers.DataBind(); idr.Close(); con.Close(); int recordCount = Convert.ToInt32(cmd.Parameters["@RecordCount"].Value); PopulatePager(recordCount, pageIndex); } } } private void PopulatePager(int recordCount, int currentPage) { //double dblPageCount = System.Convert.ToDouble(System.Convert.ToDecimal(recordCount) / (double)System.Convert.ToDecimal(PageSizes)); double dblPageCount = (double)(recordCount / (decimal)PageSizes); int pageCount = System.Convert.ToInt32(Math.Ceiling(dblPageCount)); List
pages = new List
(); if (pageCount > 0) { if (currentPage > 1) pages.Add(new ListItem("First", "1")); if (currentPage > 1) pages.Add(new ListItem("Previous", (currentPage - 1).ToString())); for (int i = 1; i <= pageCount; i++) pages.Add(new ListItem(i.ToString(), i.ToString(), i != currentPage)); if (currentPage < pageCount) pages.Add(new ListItem("Next", (currentPage + 1).ToString())); if (currentPage != pageCount) pages.Add(new ListItem("Last", pageCount.ToString())); } rptPager.DataSource = pages; rptPager.DataBind(); CurrentPageNumber.Text = string.Format("Showing page {0} of {1}:", currentPage, pageCount) + " Total of Records: " + +recordCount; } protected void Page_Changed(object sender, EventArgs e) { int pageIndex = int.Parse((sender as LinkButton).CommandArgument); GetCustomersPageWise(pageIndex); } private int TotalRowCount { get { object o = ViewState["TotalRowCount"]; if ((o == null)) return -1; else return Convert.ToInt32(o); } set { ViewState["TotalRowCount"] = value; } } }
Preview
Tags
paging system includes Columning with ASP.NET
ASP.NET website
Allow you to page through your records effortlessly
ASP.NET Paging
ASP.NET Pagenation
C# paging