is neither a DataColumn nor a DataRelation for table Table on RadGrid

by ebarcza 6/28/2011 2:41:00 AM

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>

Tags: ,

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

About the author

Name of author Author name
Something about me and what I do.

E-mail me Send mail

Calendar

<<  September 2017  >>
MoTuWeThFrSaSu
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678

View posts in large calendar

Recent comments

Tags

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2017

Sign in