I have a datagrid in which I put a button that, when selected, runs a command to check or uncheck a checkbox. That works fine. The method I am using is the onitemcommand. Now, I have tried to implement sorting by columns, and I used code that I know has worked in the past, but for some reason anytime a user hits a column to sort by, it somehow is invoking the onitemcommand code, and it errors out. Why would this happen or how could I get around it?