Datagrid sorting does not work

V

Veeves

I have added sorting to my datagrid. I added the event handler

Private Sub dgrItems_SortCommand(ByVal source As Object, _
ByVal e As
System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles
dgrItems.SortCommand
processSortIt(e.SortExpression)
End Sub

I also have an Private Sub dgrItems_ItemCommand event handler on this
web page.

When I click on one of the links in the header that should fire the
SortCommand event, the ItemCommand fires instead.

Anyone know a way to get around this?
 
E

Elton Wang

It's true that ItemCommand fires first then SortCommand
fires.

In ItemCommand event, you can

If e.CommandName.Equals("Sort") Then
Return; ' bypass the event
End If

HTH

Elton Wang
elton_hotmail.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top