This is an error I was receiving on a RadGrid when filtering
is neither a DataColumn nor a DataRelation for table Table on RadGrid
I was using a GridTemplateColum and I was binding a label to a data field. I then turned on GridFiltering by setting AllowFilteringByColumn="True" on the Grid properties.
When I tried to run a filter on this field:
<telerik:GridTemplateColumn HeaderText="Contract Min Fee" SortExpression="MinFee" >
<ItemTemplate>
<asp:Label ID="lblContractMinFee" runat="server" Text='<%# Bind("MinFee", "{0:C}") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:Label runat="server" ID="lblContractMinFeeTotal"></asp:Label>
</FooterTemplate>
<ItemStyle HorizontalAlign="Right" />
</telerik:GridTemplateColumn>
I received this error is neither a DataColumn nor a DataRelation for table Table on RadGrid
In order to fix this error I had to define a datafield on the GridTemplateColumn markup, like this:
<telerik:GridTemplateColumn HeaderText="Contract Min Fee" SortExpression="MinFee" DataField="MinFee" >
<ItemTemplate>
<asp:Label ID="lblContractMinFee" runat="server" Text='<%# Bind("MinFee", "{0:C}") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:Label runat="server" ID="lblContractMinFeeTotal"></asp:Label>
</FooterTemplate>
<ItemStyle HorizontalAlign="Right" />
</telerik:GridTemplateColumn>