This article provides a demo of how to divide up data into pages. Mayank Gupta illustrates how to automatically create pages containing the number of rows you require and how to make a custom interface.
One example of using the DataGrid control to display data is the use of “paging”. When you have a large number of rows to display, sending them all to the client in one group at once doesn’t make sense. Your client will get impatient waiting for them all to arrive and may find that they actually wanted to see something else instead. To prevent this aggravation and waste of bandwidth, we actually divide the output into pages containing 10 –20 rows per page.
DataGrid web control makes it easy to provide a paging feature. It contains logic that can automatically create pages containing the number of rows you require, and it can render the navigation control in a range of ways. You can also take over paging entirely and implement all the features yourself to provide a custom interface.
Our example that uses the automatic paging feature is used with a DataGrid control as well as EDITITEMTEMPLATE.
<appSettings><add key="strConn" value="workstation id='VENIRE-102-011';packet size=4096;integrated security=SSPI;data source='VENIRE-102-011\MAYANK';persist security info=True;initial catalog=vkmf"></add>
</appSettings>
CREATE TABLE [DocTemplate] (
[DocTId] [int] NOT NULL ,
[DocTitle] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[PostDate] [datetime] NOT NULL CONSTRAINT [DF_DocTemplate_PostDate] DEFAULT (getdate()),
[FuncId] [int] NULL ,
[TemplateAttachment] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[MetaData] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[Image] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL CONSTRAINT [DF_DocTemplate_Image] DEFAULT ('UnrecoFile.jpg')
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
Insert Into DocTemplate values(1,Microsoft Stake Holder Request’,’1/1/1900 0:00’,1,’DocTemplate\VKMFStakeholder Requests-1.doc’,’<Long Text>’,’UnrecoFile.jpg’)
Insert Into DocTemplate values(2, Microsoft Stake Holder Request’,’1/1/1900 0:00’,1,’DocTemplate\VKMFStakeholder Requests-1.doc’,’<Long Text>’,’UnrecoFile.jpg’)
Insert Into DocTemplate values(3, Microsoft Stake Holder Request’,’1/1/1900 0:00’,1,’DocTemplate\VKMFStakeholder Requests-1.doc’,’<Long Text>’,’UnrecoFile.jpg’)
Insert Into DocTemplate values(4, Microsoft Stake Holder Request’,’1/1/1900 0:00’,1,’DocTemplate\VKMFStakeholder Requests-1.doc’,’<Long Text>’,’UnrecoFile.jpg’)
Insert Into DocTemplate values(5, Microsoft Stake Holder Request’,’1/1/1900 0:00’,1,’DocTemplate\VKMFStakeholder Requests-1.doc’,’<Long Text>’,’UnrecoFile.jpg’)
Insert Into DocTemplate values(6, Microsoft Stake Holder Request’,’1/1/1900 0:00’,1,’DocTemplate\VKMFStakeholder Requests-1.doc’,’<Long Text>’,’UnrecoFile.jpg’)
Insert Into DocTemplate values(7, Microsoft Stake Holder Request’,’1/1/1900 0:00’,1,’DocTemplate\VKMFStakeholder Requests-1.doc’,’<Long Text>’,’UnrecoFile.jpg’)
Insert Into DocTemplate values(8, Microsoft Stake Holder Request’,’1/1/1900 0:00’,1,’DocTemplate\VKMFStakeholder Requests-1.doc’,’<Long Text>’,’UnrecoFile.jpg’)
CREATE TABLE [UserDocDefault] (
[UserId] [int] NULL ,
[DocTId] [int] NULL ,
[DateTo] [datetime] NULL CONSTRAINT [DF_UserDocDefault_DateTo] DEFAULT (getdate()),
[DateTill] [datetime] NULL CONSTRAINT [DF_UserDocDefault_DateTill] DEFAULT (getdate()),
[Activate] [tinyint] NULL CONSTRAINT [DF_UserDocDefault_Activate] DEFAULT (0)
) ON [PRIMARY]
GO
Insert Into UserDocDefault values(11003,1, ‘5/22/2004’,’ 5/26/2004’, 0)
Insert Into UserDocDefault values(11003,2, ‘5/22/2004’,’ 5/26/2004’, 0)
Insert Into UserDocDefault values(11003,3, ‘5/22/2004’,’ 5/26/2004’, 0)
Insert Into UserDocDefault values(11003,4, ‘5/22/2004’,’ 5/26/2004’, 0)
Insert Into UserDocDefault values(11003,5, ‘5/22/2004’,’ 5/26/2004’, 0)
Insert Into UserDocDefault values(11003,6, ‘5/22/2004’,’ 5/26/2004’, 0)
Insert Into UserDocDefault values(11003,7, ‘5/22/2004’,’ 5/26/2004’, 0)
Insert Into UserDocDefault values(11003,8, ‘5/22/2004’,’ 5/26/2004’, 0)