HI,
I get an error when I try to apply a filter on the value of a combobox. I have placed the combobox in a telerik:GridTemplateColumn.
When I filter on any other column it works as expected.
Here is the code
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Stedkoder.aspx.cs" Inherits="Stedkoder._Default" MasterPageFile="~/Stedkoder.Master" Debug="true" %>
<
asp:Content
ID
=
"Content2"
ContentPlaceHolderID
=
"CPL_Addon"
Runat
=
"Server"
>
<
asp:SqlDataSource
ID
=
"DS_Stedkoder"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:um_edw_addonConnectionString %>"
DeleteCommand="DELETE FROM [organisationsstruktur].[Sted_Dim_Staging] WHERE [StedKode] = @StedKode"
InsertCommand="INSERT INTO [organisationsstruktur].[Sted_Dim_Staging] ([StedKode], [Sted], [StedNiveau1]) VALUES (@StedKode, @Sted, @StedNiveau1)"
SelectCommand="SELECT StedKode, Sted, StedNiveau1, StedNiveau2
FROM [organisationsstruktur].[Sted_Dim_Staging] a
LEFT OUTER JOIN [organisationsstruktur].[Sted_Niveau1_dim_Staging] b
ON (a.[StedNiveau1] = b.StedNiveau1Kode)
ORDER BY [StedKode]"
UpdateCommand="UPDATE [organisationsstruktur].[Sted_Dim_Staging] SET [Sted] = @Sted, [StedNiveau1] = @StedNiveau1 WHERE [StedKode] = @StedKode">
<
DeleteParameters
>
<
asp:Parameter
Name
=
"StedKode"
Type
=
"Int32"
/>
</
DeleteParameters
>
<
UpdateParameters
>
<
asp:Parameter
Name
=
"Sted"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"StedNiveau1"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"StedKode"
Type
=
"Int32"
/>
</
UpdateParameters
>
<
InsertParameters
>
<
asp:Parameter
Name
=
"Sted"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"StedNiveau1"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"StedKode"
Type
=
"Int32"
/>
</
InsertParameters
>
</
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"DS_Niveau1"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:um_edw_addonConnectionString %>"
SelectCommand="SELECT [StedNiveau1Kode] FROM [organisationsstruktur].[Sted_Niveau1_dim_Staging]">
</
asp:SqlDataSource
>
<
telerik:radgrid
ID
=
"Grid_Stedkode"
runat
=
"server"
AllowSorting
=
"True"
AutoGenerateColumns
=
"False"
AutoGenerateDeleteColumn
=
"False"
AutoGenerateEditColumn
=
"False"
DataSourceID
=
"DS_Stedkoder"
GridLines
=
"Vertical"
AllowAutomaticDeletes
=
"True"
Font-Names
=
"Verdana"
AllowAutomaticInserts
=
"True"
AllowAutomaticUpdates
=
"True"
ForeColor
=
"#333333"
AllowCustomPaging
=
"True"
Skin
=
"Office2007"
AllowFilteringByColumn
=
"True"
>
<
GroupingSettings
CaseSensitive
=
"false"
/>
<
MasterTableView
DataSourceID
=
"DS_Stedkoder"
datakeynames
=
"StedKode"
>
<
RowIndicatorColumn
>
<
HeaderStyle
Width
=
"20px"
/>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
>
<
HeaderStyle
Width
=
"20px"
/>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridEditCommandColumn
UniqueName
=
"EditColumn"
ButtonType
=
"ImageButton"
InsertImageUrl
=
"Images/Edit.gif"
>
<
HeaderStyle
Width
=
"30px"
></
HeaderStyle
>
</
telerik:GridEditCommandColumn
>
<
telerik:GridButtonColumn
UniqueName
=
"DeleteColumn"
ButtonType
=
"ImageButton"
ImageUrl
=
"Images/Delete.gif"
CommandName
=
"Delete"
>
<
HeaderStyle
Width
=
"30px"
></
HeaderStyle
>
</
telerik:GridButtonColumn
>
<
telerik:GridBoundColumn
DataField
=
"StedKode"
DataType
=
"System.Int32"
HeaderText
=
"StedKode"
ReadOnly
=
"True"
SortExpression
=
"StedKode"
UniqueName
=
"StedKode"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"EqualTo"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Sted"
HeaderText
=
"Sted"
SortExpression
=
"Sted"
UniqueName
=
"Sted"
AutoPostBackOnFilter
=
"true"
FilterControlWidth
=
"200px"
CurrentFilterFunction
=
"Contains"
>
</
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Niveau 1"
AutoPostBackOnFilter
=
"true"
FilterControlWidth
=
"200px"
CurrentFilterFunction
=
"Contains"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"Niveau1"
runat
=
"server"
text='<%# Eval("StedNiveau1") %>' />
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadComboBox
ID
=
"StedNiveau1Combo"
AppendDataBoundItems
=
"true"
runat
=
"server"
DataSourceID
=
"DS_Niveau1"
Width
=
"300px"
DataTextField
=
"StedNiveau1Kode"
DataValueField
=
"StedNiveau1Kode"
Text
=
"Niveau 1"
SelectedValue='<%# Bind("StedNiveau1")%>' >
</
telerik:RadComboBox
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
DataField
=
"StedNiveau2"
HeaderText
=
"Niveau 2"
SortExpression
=
"StedNiveau2"
ReadOnly
=
"true"
UniqueName
=
"StedNiveau2"
AutoPostBackOnFilter
=
"true"
FilterControlWidth
=
"200px"
CurrentFilterFunction
=
"Contains"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:radgrid
>
</
asp:Content
>
And the Error message:
Server Error in '/' Application.
--------------------------------------------------------------------------------
is neither a DataColumn nor a DataRelation for table DefaultView.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: is neither a DataColumn nor a DataRelation for table DefaultView.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentException: is neither a DataColumn nor a DataRelation for table DefaultView.]
System.Data.DataRowView.get_Item(String property) +1744826
lambda_method(ExecutionScope , DataRowView ) +65
System.Linq.WhereEnumerableIterator`1.MoveNext() +161
Telerik.Web.UI.GridDataTableFromEnumerable.FillDataTableFromEnumerable(IQueryable enumerable) +176
Telerik.Web.UI.GridDataTableFromEnumerable.FillData35() +4028
Telerik.Web.UI.GridDataTableFromEnumerable.FillData() +608
Telerik.Web.UI.GridResolveEnumerable.Initialize() +32
Telerik.Web.UI.GridResolveEnumerable.EnsureInitialized() +20
Telerik.Web.UI.GridEnumerableFromDataView..ctor(GridTableView owner, DataView dataView, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +158
Telerik.Web.UI.GridDataSourceHelper.CreateGridEnumerable(GridTableView owner, IEnumerable enumerable, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +76
Telerik.Web.UI.GridDataSourceHelper.GetResolvedDataSource(GridTableView owner, Object dataSource, String dataMember, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +383
Telerik.Web.UI.GridTableView.get_ResolvedDataSource() +140
Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource) +309
Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +498
System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +57
System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +114
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +31
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +142
Telerik.Web.UI.GridTableView.PerformSelect() +4
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
Telerik.Web.UI.GridTableView.DataBind() +221
Telerik.Web.UI.GridTableView.Rebind() +48
Telerik.Web.UI.GridFilterCommandEventArgs.ExecuteCommand(Object source) +517
Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e) +134
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +38
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +115
Telerik.Web.UI.GridItem.FireCommandEvent(String commandName, Object commandArgument) +46
Telerik.Web.UI.RadGrid.RaisePostBackEvent(String eventArgument) +6151
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.4200; ASP.NET Version:2.0.50727.4205
What do I do to fix this error?
Best regards
Erik Hansen