Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
Enable sort for custom data objects with objectdatasource
posted

I am trying to enable sorting for custom data objects bound to ultrawebgrid via an objectdatasource.

I tried to disable client side sorting, and set it to only serverside sort, but all that seems to happen is that the client side sort attempts to run first, and it never even gets to the server side sort (I get a error message saying

"The data source 'ObjectDataSource1' does not support sorting with IEnumerable data. Automatic sorting is only supported with DataView, DataTable, and DataSet."

This is my aspx code. Can anyone tell me what I am doing wrong? I can't even get to the postback before it crashes. 

When I was tracing, at page prerender, the AllowSorting property on both the Band and the ultrawebgrid was both set to "Yes".

 

        <igtbl:ultrawebgrid id="UltraWebGrid1" runat="server" DataSourceID="ObjectDataSource1" 

            OnSortColumn="UltraWebGrid1_SortColumn" >

        <Bands>

        <igtbl:UltraGridBand AllowAdd="No" AllowDelete="No" AllowRowNumbering="Continuous" AllowUpdate="No" AllowColSizing="Free" AllowColumnMoving="OnServer"

            AllowSorting="Yes" >

            <Columns>

                <igtbl:UltraGridColumn Key="ItemID" IsBound="True" DataType="System.Int32" BaseColumnName="ItemID">

                <Header Caption="ItemID"></Header>

                </igtbl:UltraGridColumn>

            </Columns>

            <FilterOptions AllowRowFiltering="OnClient" FilterUIType="FilterRow"></FilterOptions>

            <AddNewRow Visible="NotSet" View="NotSet"></AddNewRow>

        </igtbl:UltraGridBand>

        </Bands>

        <DisplayLayout Version="4.00" Name="UltraWebGrid1"

            AllowSortingDefault="Yes" HeaderClickActionDefault="SortSingle"

            AllowUpdateDefault="Yes" AllowColSizingDefault="Free" RowHeightDefault="20px" TableLayout="Fixed" AllowColumnMovingDefault="OnServer" StationaryMargins="Header" BorderCollapseDefault="Separate" StationaryMarginsOutlookGroupBy="True" AutoGenerateColumns="false">

        </DisplayLayout>

    

        </igtbl:ultrawebgrid>

        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetMNTShelfItems"

            TypeName="BTS.DataTransfer.Shelf.MNTTransactions" EnableCaching="false" >

            <SelectParameters>

                <asp:FormParameter DefaultValue="1" FormField="txtRegionID" Name="regionID"

                    Type="String" />

                <asp:Parameter Direction="input" Type="string" Name="sortParam">

                </asp:Parameter>

                <asp:Parameter Direction="input" Type="Byte" Name="sortDir" DefaultValue="0">

                </asp:Parameter>                    

            </SelectParameters>

        </asp:ObjectDataSource>