Click here to Skip to main content
Click here to Skip to main content

Custom DataGrid for Alphabetic Paging

, 28 Feb 2006
Rate this:
Please Sign up or sign in to vote.
This custom DataGrid control provides alphabetic paging for a given column.

Sample Image - Custom_DataGrid_Control.jpg


One of my most used ASP.NET control is DataGrid. Presenting data from tables is very easy and nice with only one exception - the page navigator. Showing only page numbers or only two links (to previous and next page) is insufficient for me, and completely inexplicable for my clients. So I decided to create DataGrid Server Control, the main task of which is to providing paging alphabetically.

Using the control

1. Copy CustDataGrid.dll in your web application bin folder.
2. Add  this line on top of your aspx page or add control in toolbox by customize toolbox and drop control on your page.

<%@ Register TagPrefix="cc1" Namespace="CustDataGrid" 
                Assembly="CustDataGrid" %>

3. add control on your page in form tag
<%cc1:myCustDG id="MyCustDG1" 
  style="Z-INDEX: 101; LEFT: 110px; POSITION: absolute; TOP: 26px" 
  runat="server" Height="167px" Width="286px" BackColor="Info">
    <AlternatingItemStyle BackColor="MistyRose"></AlternatingItemStyle>
    <FooterStyle Font-Bold="True" BackColor="LightPink"></FooterStyle>
    <HeaderStyle Font-Bold="True" BackColor="LightPink"></HeaderStyle>

4. Set control properties in your codebihind page

MyCustDG1.strConn = "data source=.;initial catalog=Northwind;" + 
                    "persist security info=False;user id=sa;password=";
MyCustDG1.sqlQuery = "select CustomerID,CompanyName," + 
                     "ContactName,City,Country from customers";
MyCustDG1.Visible = true;
MyCustDG1.autoCols = true;
MyCustDG1.AlphabaticPaging = true;
MyCustDG1.PagingColumn = "CompanyName";

Control's properties

1. strConn: SQL connection string
2. sqlQuery: Select query for fill DataGrid
3. AlphabaticPaging (bool): true - show alphabatic paging, false - show normal paging
4. PagingColumn: Column name which depends on alphabatic paging 


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Jitendra Bansiwal
Web Developer
India India
Around five years of experience in the field of application software development including
Three years of experience in .NET technology.

Comments and Discussions

Generalthanks man [modified] Pinmemberthenam25-Sep-07 10:54 
Generalit's sound exciting Pinmemberthenam25-Sep-07 0:12 
Questionquestion? Pinmembergmageshh27-Oct-06 10:11 
AnswerHow do i use Stored Procedure instead of sql query? Urgent!!!! PinmemberGM7-Aug-09 10:07 
GeneralUseless without Source Code Pinmemberpbansal8-Aug-06 2:15 
Questionwhere is the source? PinmemberSkunkyb5-Mar-06 22:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.141022.2 | Last Updated 1 Mar 2006
Article Copyright 2006 by Jitendra Bansiwal
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid