Home All Groups Group Topic Archive Search About
Author
18 Mar 2005 8:04 PM
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?


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Author
18 Mar 2005 8:38 PM
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

Show quoteHide quote
>-----Original Message-----
>
>
>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
Show quoteHide quote
>SortCommand event, the ItemCommand fires instead.
>
>Anyone know a way to get around this?
>
>
>*** Sent via Developersdex http://www.developersdex.com
***
>Don't just participate in USENET...get rewarded for it!
>.
>
Author
18 Mar 2005 9:49 PM
Veeves
Thanks. This was a simple solution.

Veeves


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!