Click here to Skip to main content
12,243,752 members (41,516 online)
Click here to Skip to main content
Add your own
alternative version

Stats

26.4K views
167 downloads
21 bookmarked
Posted

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

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

Share

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.

You may also be interested in...

Comments and Discussions

 
Generalthanks man [modified] Pin
thenam25-Sep-07 11:54
memberthenam25-Sep-07 11:54 
Generalit's sound exciting Pin
thenam25-Sep-07 1:12
memberthenam25-Sep-07 1:12 
Questionquestion? Pin
gmageshh27-Oct-06 11:11
membergmageshh27-Oct-06 11:11 
AnswerHow do i use Stored Procedure instead of sql query? Urgent!!!! Pin
GM7-Aug-09 11:07
memberGM7-Aug-09 11:07 
GeneralUseless without Source Code Pin
pbansal8-Aug-06 3:15
memberpbansal8-Aug-06 3:15 
Questionwhere is the source? Pin
Skunkyb5-Mar-06 23:33
memberSkunkyb5-Mar-06 23:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    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 | Terms of Use | Mobile
Web01 | 2.8.160426.1 | Last Updated 1 Mar 2006
Article Copyright 2006 by Jitendra Bansiwal
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid