posts - 5 , comments - 1 , trackbacks - 0

Wednesday, November 9, 2016

Reposition DataTable Columns

After data bound to DataTable (say dtUser is DataTable name), if we would like to interchange FirstName (first column) and LastName (second column) columns position then we have to do like below


dtUser.Columns["LastName"].SetOrdinal(0); //Initial ordinal position is ZERO 

Now LastName will be the first column and FirstName will be the second column in data table

--Karthick Raju

Posted On Wednesday, November 9, 2016 4:54 AM | Comments (0) | Filed Under [ Asp.Net C# ]

Powered by: