I know that GridView can handle sorting and paging if I bind it to an ObjectDataSource that only needs to get the list of items in a SelectMethod. Since apparently all the ODS is doing is get the items I tried to bind the GridView directly to the collection of items.
I tried:
[aspx]
<asp:Button runat="server" OnClick="ItemsSearch" Text="Search" />
<asp:GridView runat="server" ID="ItemsGV"
AllowPaging="true" AllowSorting="true" PageSize="4" />
[codebehind]
protected void ItemsSearch(object sender, EventArgs e)
{
DataSet Items = new DataSet();
Items.ReadXml(MapPath("Items.xml"));
Session["items"] = Items;
ItemsGV.DataSource = Session["items"];
ItemsGV.DataBind();
}
The GridView is loaded with the data but if I click to sort or change page nothing happens.
Any ideea how to make this kind of binding work?
After studying some tutorials I ended up with this solution:
[Default.aspx]
[Default.aspx.cs]
[Items.xml]