This solution worked for me and did it in just a few lines of code:

http://neiliscoding.blogspot.com/2011/09/remove-grid-columns-dynamically-in.html