I have been modifying the small business starter kit. In the"News" portion of the website, I have a gridview with boundfields rather than a template in the original code . I am reading all my data from the xml file. I would like to be able to sort on my columns but I am getting the error message.
The data source 'ObjectDataSourceAllProjects' does not support sorting with IEnumerable data. Automatic sorting is only supported with DataView, DataTable, and DataSet.
Can I not do this? I have searched this forum for similar posts and got a few matches but I don't understand what they are talking about. Please help. Below is my code.
<div id="content-main-two-column">
<h1>
Our Projects</h1>
<hr />
<!-- END MAIN COLUMN -->
<asp:Panel ID="AllProjectsPanel" runat="server">
<%--Data Source Controls--%>
<asp:ObjectDataSource ID="ObjectDataSourceAllProjects" runat="server" SelectMethod="GetAllProjects"
TypeName="Projects" />
<asp:GridView ID="GridViewAllProjects" runat="server" AutoGenerateColumns="False" DataSourceID="ObjectDataSourceAllProjects"
AllowPaging="True" PageSize="15" OnRowCreated="GridViewAllProjects_RowCreated" BorderWidth="0"
BorderColor="white" CellPadding="6" DataKeyNames="Id" AllowSorting="true" >
<HeaderStyle HorizontalAlign="Left" CssClass="ProjectHeader" />
<RowStyle CssClass="ProjectData" />
<Columns>
<asp:BoundField DataField="title" HeaderText="Project Name" ItemStyle-Width="25%" SortExpression="title" />
<asp:BoundField DataField="year" HeaderText="Year" ItemStyle-Width="20%" SortExpression="year"/>
<asp:BoundField DataField="location" HeaderText="Location" ItemStyle-Width="20%" SortExpression="location" />
<asp:BoundField DataField="content" HeaderText="Project Type" ItemStyle-Width="35%" SortExpression="content" />
</Columns>
<PagerSettings Mode="NumericFirstLast" Position="TopAndBottom" />
</asp:GridView>
</asp:Panel>
</div>