Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Setting displayname as header in GetDataTable

$
0
0

HI,

I am fetching records from a custom list and binding to a datatable.

The datatable works, but the header shows the Internal names of the columns. How to set the display name of the column as header when converting to datatable.

My current code is as below:

SPQuery listQuery = new SPQuery();
listQuery.Query = "<Where><Eq><FieldRef Name='" + testName+ "' /><Value Type='Text'>" + "abc" + "</Value></Eq></Where><OrderBy><FieldRef Name='Created' Ascending='FALSE' /></OrderBy>";

SPListItemCollection spListItemCol = list.GetItems(listQuery);

Datatable dtGeneratedList = spListItemCol.GetDataTable();

How to show the display name as header?

Thanks


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>