Filter your database table alphabetically
Skip Navigation Links.

Filter your database table alphabetically

Skip Navigation LinksHome :: ASP.NET :: Filter alphabetically

Here’s how to create a page to filter your database table alphabetically Demo

First create the toolbar on the page

[a] b c d e f g h i j k l m n o p q r s t u v w x y z    

Here’s the function to call that will do it for you. It automatically shows the selected letter disabled like this [a]

 Sub AlphabetSelect(Optional ByVal Header As String = "")

  Dim chr As String = Request("chr")

  If chr <> "" Then chr = chr.ToLower

  Dim MyArray() As String = Split("a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z", ",")

  Response.Write("<div align=center class=pricing>")

  If Header <> "" Then Response.Write("<b>" & Header & "</b><br />")

  Response.Write("<nobr>")

  Dim IntI As Integer

  For IntI = LBound(MyArray) To UBound(MyArray)

   If MyArray(IntI) = chr Then

    Response.Write("<b>[")

   Else

    Response.Write("<a href='?chr=" & MyArray(IntI) & "' >")

    Response.Write(" ")

   End If

   Response.Write(MyArray(IntI))

   If MyArray(IntI) = chr Then

    Response.Write("]</b>&nbsp;")

   Else

    Response.Write("</a>&nbsp;")

   End If

  Next  'IntI

  Response.Write("</nobr></div>")

 End Sub

Call it like this…

The rest of this page is hidden, you must be a member to view it

To become a member and get immediate access to the course please join here Free!

Already Enrolled? please click here to Login

Next >> Microsoft 70-305 Exam
top of page
©1996/2010 BennySutton.com
all images © their respective owners
Powered By Buy a business This site uses Thumbshots previews
  BensGuitars.com