This is a migrated thread and some comments may be shown as answers.

crash while filtering a column of type int with allow nulls

2 Answers 106 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Luci
Top achievements
Rank 1
Luci asked on 11 Aug 2008, 08:35 AM
hello, I have a column in a radgrid that is a lookup in another table, with allow null. so it is GridDropDownColumn. the problem is while filtering (by its ID), it crashes somewhere in telerik code.

Specified cast is not valid. Stack: at lambda_method(ExecutionScope , DataRowView ) at System.Linq.Enumerable.d__0`1.MoveNext() at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source) at lambda_method(ExecutionScope ) at System.Linq.EnumerableExecutor`1.Execute() at System.Linq.EnumerableExecutor`1.ExecuteBoxed() at System.Linq.EnumerableQuery`1.System.Linq.IQueryProvider.Execute(Expression expression) at Telerik.Web.UI.GridDynamicQueryable.Count(IQueryable source) at Telerik.Web.UI.GridDataTableFromEnumerable.FillData35() at Telerik.Web.UI.GridDataTableFromEnumerable.FillData() at Telerik.Web.UI.GridResolveEnumerable.Initialize() at Telerik.Web.UI.GridResolveEnumerable.EnsureInitialized() at Telerik.Web.UI.GridEnumerableFromDataView..ctor(GridTableView owner, DataView dataView, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) at Telerik.Web.UI.GridDataSourceHelper.CreateGridEnumerable(GridTableView owner, IEnumerable enumerable, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) at Telerik.Web.UI.GridDataSourceHelper.GetResolvedDataSource(GridTableView owner, Object dataSource, String dataMember, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) at Telerik.Web.UI.GridTableView.get_ResolvedDataSource() at Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource) at Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) at System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) at System.Web.UI.WebControls.DataBoundControl.PerformSelect() at Telerik.Web.UI.GridTableView.PerformSelect() at System.Web.UI.WebControls.BaseDataBoundControl.DataBind() at Telerik.Web.UI.GridTableView.DataBind() at Telerik.Web.UI.GridTableView.Rebind() at Telerik.Web.UI.GridFilterCommandEventArgs.ExecuteCommand(Object source) at Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e) at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) at Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) at Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) at Telerik.Web.UI.GridItem.FireCommandEvent(String commandName, Object commandArgument) at Eximtur.UI.Common.FilteringTemplateColumn.combo_SelectedIndexChanged(Object sender, RadComboBoxSelectedIndexChangedEventArgs e) in C:.....Common\FilteringTemplateColumn.cs:line 84 at Telerik.Web.UI.RadComboBox.RaiseSelectedIndexChandedEvent() at Telerik.Web.UI.RadComboBox.RaisePostDataChangedEvent() at Telerik.Web.UI.RadDataBoundControl.System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent() at System.Web.UI.Page.RaiseChangedEvents() at System.Web.UI.Page.ProcessRequestMain(Boolean


p.s.
We made a custom filter that allows filtering by values of the lookup tables in a combobox, but it crashes in the same spot, when firing the filter event.

some workaround I can think of is bringing say '-2' instead of <null> from database, I never tried it yet though.

easy to reproduce, just bind a grid to a column of type int with allow null.
filter using "equal" -> it will crash.



2 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 11 Aug 2008, 08:38 AM
Hi Viorel,

Please set EnableLinqExpressions to false and let me know about the result.

Regards,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Kirill Ugolnikov
Top achievements
Rank 1
answered on 15 Aug 2008, 05:10 AM
Hello.

I was have the same error. After EnableLinqExpressions=false it works.

Regards.
Tags
Grid
Asked by
Luci
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Kirill Ugolnikov
Top achievements
Rank 1
Share this question
or