posts - 5 , comments - 1 , trackbacks - 0

My Links

News

Archives

Post Categories

Image Galleries

IIS

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["FirstName"].SetOrdinal(1);  

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



Print | posted on Wednesday, November 9, 2016 4:54 AM | Filed Under [ Asp.Net C# ]

Feedback

No comments posted yet.
Post A Comment
Title:
Name:
Email:
Comment:
Verification:
 

Powered by: