0

I'm new to SharePoint List and i need to bind gridview using list item collection object like below

SPList splEmployees = SPContext.Current.Web.Lists["Employees"];
spgvEmployees.DataSource = splEmployees.Items;//or splEmployees.GetItems();
spgvEmployees.DataBind();

this is not success when i bind it to gridview contains Title and EmployeeID columns but it success when i remove EmployeeID column.

2 Answers 2

1

The DataGridView .NET component provides the approach of data binding to database table or dataset in GridView, without of complex process.

0

Use the SPListItemCollection.GetDataTable method. The beauty of it is that you can cache the results as a DataTable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.