views:

18

answers:

0

I am creating a dynamic grid which is created by selecting the format defined in the below XML.My select list includes all columns in this XML,I want to position these columns columns on the basic of position attribute in XML.

   <gridFormat>
     <column property="CustomerID" dbName="CustName" HeaderText="Customer" IsVisible="0" Position="1" />
     <column property="CustomerName" dbName="FacilityName" HeaderText="Facility" IsVisible="1" Position="3" />
     <column property="FacilityInternalID" dbName="Pname" HeaderText="Patient" IsVisible="1" Position="2" />
   </gridFormat>

I cannot select them in the order specified by the position attribute. I can do it in C# by looping around the returned datatable and specifically position columns using datatable.columns.setordinal() method. Is there any better way in SQL or C# to accomplish this.