Sub onRowCommandActioner(ByVal sender As Object, ByVal e As GridViewCommandEventArgs)
If e.CommandName = "SpecialFunction" Then
'do your special stuff
And for this you'd add the following parameter to your button field:
This means that your special stuff will only be fired for your specific command and sorting will be fired as normal. I was today however scratching my head for a little while today as it still wouldn't sort for me. This was resolved by putting my GridView into an UpdatePanel.