One of the solution is to create dynamic select query based on column selected.
If not then you can generate bound column dynamically like this.
BoundField bd = new BoundField();
bd.DataField = "ProductID";
bd.HeaderText = "ProductID";
grdView.Columns.Add(bd);
for dynamically adding template column follow below link
http://forums.asp.net/t/1001702.aspx[
^]