Hi Jay,
This is easy. There is an example in the out-of-box solution for Asset Tracking. The views are sorted using JScript. You can look at the code by exporting the files for the solution and opening the script.js file. The solution is one of the default samples installed with InfoPath. Sorting in C# is similar. Good luck!
Patrick Halstead [InfoPath MVP]
InfoPathDev
Patrick Halstead
Project Manager at Qdabra