Creating the Alphabetical List and Paging in GridView In ASP.NET
Custom Search
Step 1:
'gvList is GrirdView
Protected Sub gvList_RowCreated(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.Footer Then
Dim cell As TableCell = e.Row.Cells(0)
cell.ColumnSpan = 2
For i As Integer = 65 To (65 + 25)
Dim lb As New LinkButton()
lb.Text = [Char].ConvertFromUtf32(i) & " "
lb.CommandArgument = [Char].ConvertFromUtf32(i)
lb.CommandName = "AlphabeticalPaging"
cell.Controls.Add(lb)
Next
End If
End Sub
Step 2:
Dim dt as New Datatable
Protected Sub gvCategories_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs)
If e.CommandName.Equals("AlphabeticalPaging") Then
dt = GetDataTable("SELECT ProductID, ProductName FROM Products WHERE ProductName LIKE '" & e.CommandArgument & "%'"
gvList.DataSource = dt
gvList.DataBind()
End If
End Sub
————————————————————————————————————————————————————————-






That was inspiring,
Keep up the good work...
Thanks for writing about it
Reply to this