i am using a objectdatasource to populate my grid when i select the page where the grid is, it enters on the methods select and selectcount, but when sorting it gives me column not found. what is it strange is that i have a breakpoint on the method select and if i try to sort by a fiedl the parameter sSortColumn should have the column id, and it should enter the breakpoint but it doesnt.
this is my grid and objectdatasource
<ig:WebDataGrid ID="WebDataGridAutAssiduidade" runat="server" AutoGenerateColumns="False" Width="100%"
Height="99%" DataKeyFields="ID" DataSourceID="odsAutAssiduidade" >
<EmptyRowsTemplate>
Sem registos...</EmptyRowsTemplate>
<Columns>
<ig:TemplateDataField Key="chkBox" Width="40px">
<HeaderTemplate>
<asp:CheckBox runat="server" ID="chkAll" CssClass="center" OnClick="SelectAll(this)" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox runat="server" ID="chk" CssClass="center" />
</ItemTemplate>
</ig:TemplateDataField>
<ig:BoundDataField DataFieldName="ID" Hidden="false" Key="ID">
<Header Text="ID" />
</ig:BoundDataField>
</Columns>
<behaviors>
<ig:Sorting>
</ig:Sorting>
<ig:EditingCore>
</ig:EditingCore>
<ig:ColumnResizing>
</ig:ColumnResizing>
<ig:Paging PagerMode="NumericFirstLast" PageSize="20" QuickPages="5">
</ig:Paging>
<ig:RowSelectors RowNumbering="True">
</ig:RowSelectors>
</behaviors>
</ig:WebDataGrid>
<asp:ObjectDataSource ID="odsAutAssiduidade" runat="server" EnablePaging="True" SelectCountMethod="GetAsAutAssiduidadeCount"
SelectMethod="GetAsAutAssiduidade" TypeName="IdOntime.AsAutorizacoesAssiduidade" SortParameterName="sSortType"
EnableCaching="True" EnableViewState="True" OldValuesParameterFormatString="original_{0}" StartRowIndexParameterName="startRowIndex" MaximumRowsParameterName="maxRows">
<selectparameters>
<asp:Parameter Name="sSortType" Type="String" />
</selectparameters>
</asp:ObjectDataSource>
and here is the methods
public DataTable GetAsAutAssiduidade(String sSortType, int maxRows, int startRowIndex)
{
return new DataTable();//testing -
}
public int GetAsAutAssiduidadeCount(String sSortType)
{
return NRows;
}
what i am doing wrong? i am using a infragistics component called webdatagrid, and i allow sorting by adding in the behaviors.
Thanks for the help.
It does work for me with the regular <asp:GridView />
. As for why breakpoint isn't hit - you enable caching in object data source. Disable it so your breakpoint will trigger:
<asp:ObjectDataSource ...
EnableCaching="false" ... />
Be aware that by default the grid isn't sorted so sSortType
can be one of: ""
, "ID"
, "ID DESC"
.