Click here to Skip to main content
15,922,007 members
Articles / Web Development / ASP.NET

AlphaNavigator Re-Make

Rate me:
Please Sign up or sign in to vote.
4.00/5 (1 vote)
5 Oct 20052 min read 39.2K   288   22   6
A remake of the AlphaNavigator control by micahbowerbank.

Sample Image - AlphaNavigator.png


While browsing The Code Project, I ran across an article by micahbowerbank which provided a control for alphanavigation. I thought this was great!!! A client had requested a feature just like this. My initial idea was to use a simple DataGrid and handle everything myself... but dragging and dropping this control sounded too good to be true. I downloaded the control and tried to create a demo project to use it. Well immediately, I saw that the control seemed to need to open a connection and then it wasn't closed. I tried closing it and it bombed. I read a little into the messages following the control and decided it might be a good opportunity to learn about making your own custom controls. Waaalaa... here is my creation, really not much of micahbowerbank's creation is left... maybe small references here and there... and there are a lot of functionalities that you may decide to add to the control...however I laid out what I feel are the base parts of the control for you. Please be kind in your reviews as this is my first control ever!

Using the Code

The following is an example of the code needed to use the control. First reference the AlphaNavigator.dll, then add it to your Toolbox. Next drag a new instance onto the page and in the properties/events panel, set the name for the ItemCommand event.

Private Sub Page_Load(ByVal sender As System.Object, _
            ByVal e As System.EventArgs) Handles MyBase.Load
    'Put user code to initialize the page here
    If Not IsPostBack Then
    End If
End Sub

Private Sub anUserBind()
    Dim SQL_COMMAND As String

    Dim myConnection As New OleDbConnection("SQL CONNECTION STRING HERE")
    Dim myCommand As New OleDbCommand(SQL_COMMAND, myConnection)
    Dim myAdapter As New OleDbDataAdapter(myCommand)
    Dim myDS As New DataSet

    AlphaNavigator1.DataSource = myDS.Tables(0).DefaultView
End Sub

Private Sub anClick(ByVal sender As System.Object, ByVal e As _
        System.Web.UI.WebControls.CommandEventArgs) _
        Handles AlphaNavigator1.ItemCommand
    Dim Letter As String = e.CommandArgument
End Sub

The Control Itself

The control itself ends up being a lot more complex than the original version. If you have the knowledge of making controls, what I've done should make some sense, I hope?? If you notice something I did wrong, I would really appreciate it if you could email me and let me know as this control was built as a learning experience and I'd like to know the mistakes I made.

One area I had difficulty with was getting the link buttons inside the control to use the same font that was set on the base control, I had to set them...but I have a feeling this could be accomplished using inheritance from the main class.

Another thing, the way it works right now you can't set the size of the spaces between each letter. I was thinking about adding that feature but for now this will do. Good Luck!


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

Written By
Web Developer
United States United States
Frank is a recent graduate of the Penn State Computer Science program. He runs a software solution company named Integral Technology Solutions located in Northeast PA offering software solutions to area businesses.

Comments and Discussions

General[Message Removed] Pin
Mojtaba Vali5-Oct-05 23:09
Mojtaba Vali5-Oct-05 23:09 
GeneralRe: What about 3 Tier!?? Pin
Anonymous6-Oct-05 4:09
Anonymous6-Oct-05 4:09 
GeneralRe: What about 3 Tier!?? Pin
Paul A. Howes14-Oct-05 2:52
Paul A. Howes14-Oct-05 2:52 
GeneralDownload not working Pin
Simone Busoli5-Oct-05 12:26
Simone Busoli5-Oct-05 12:26 
GeneralRe: Download not working Pin
Anonymous5-Oct-05 14:00
Anonymous5-Oct-05 14:00 
GeneralRe: Download not working Pin
Simone Busoli5-Oct-05 14:14
Simone Busoli5-Oct-05 14:14 

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.