Problem: I get this error when I try to filter any column in my RadGrid.I am using template columns.
"is neither a DataColumn nor a DataRelation for table DefaultView"
Here is my code of a Column
Solution: You have to check that DataField property is present or not.
"is neither a DataColumn nor a DataRelation for table DefaultView"
Here is my code of a Column
<telerik:GridTemplateColumn HeaderStyle-HorizontalAlign="Center" HeaderText="PO #" Visible="true">
<ItemTemplate>
<asp:Label ID="lblPONumber" Text='<%# Eval("_PONumber") %>' runat="server">
</asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center" />
</telerik:GridTemplateColumn>
<ItemTemplate>
<asp:Label ID="lblPONumber" Text='<%# Eval("_PONumber") %>' runat="server">
</asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center" />
</telerik:GridTemplateColumn>
Solution: You have to check that DataField property is present or not.
Here is corrected Code
<telerik:GridTemplateColumn DataField="_PONumber" HeaderStyle-HorizontalAlign="Center" HeaderText="PO #" Visible="true">
<ItemTemplate>
<asp:Label ID="lblPONumber" Text='<%# Eval("_PONumber") %>' runat="server">
</asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center" />
</telerik:GridTemplateColumn>
<ItemTemplate>
<asp:Label ID="lblPONumber" Text='<%# Eval("_PONumber") %>' runat="server">
</asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center" />
</telerik:GridTemplateColumn>
if you are still getting this error please try this things.
ReplyDelete- Make SortExpression and DataField with same parameter value.
Thanks for your reply Kishor
DeleteHI, Facing this issue when i create the columns dynamically under a button click,and i have given datafield to each column. Any help in this case?
ReplyDeleteThanks
ReplyDelete