Click here to Skip to main content
Licence 
First Posted 28 Feb 2006
Views 20,996
Bookmarked 21 times

Custom DataGrid for Alphabetic Paging

By | 28 Feb 2006 | Article
This custom DataGrid control provides alphabetic paging for a given column.

Sample Image - Custom_DataGrid_Control.jpg

Introduction

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>
   </cc1:myCustDG>

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";
MyCustDG1.GetDataGrid();
//

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 

License

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

Member

Around five years of experience in the field of application software development including
Three years of experience in .NET technology.


Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
Generalthanks man [modified] Pinmemberthenam10:54 25 Sep '07  
Generalit's sound exciting Pinmemberthenam0:12 25 Sep '07  
Questionquestion? Pinmembergmageshh10:11 27 Oct '06  
AnswerHow do i use Stored Procedure instead of sql query? Urgent!!!! PinmemberGM10:07 7 Aug '09  
GeneralUseless without Source Code Pinmemberpbansal2:15 8 Aug '06  
Questionwhere is the source? PinmemberSkunkyb22:33 5 Mar '06  

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.

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