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

Applying filter produces JavaScript error

1 Answer 35 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 26 Nov 2012, 09:58 PM
I've got a bound column that may contain null values. If I try to use filtering on it such as "contains" or "equal", I'm getting a javascript error "Object reference not set to an instance of the object". I believe the generated logic should check for null before applying the "contains" filter. Am I doing something wrong here or is it a bug? In some posts I found that EnableLinqExpressions="false"  would fix something like that. However, when I try to do that I'm getting 

Server Error in '/' Application.

Cannot interpret token '?' at position 12

The grid is bound to a list of objects and is defined as follows 
<telerik:RadGrid ID="EmployeesRadGrid" runat="server" AutoGenerateColumns="false"
                       AllowPaging="true" OnNeedDataSource="EmployeesRadGrid_NeedDataSource" EnableLinqExpressions="false"
                       oninit="EmployeesRadGrid_Init" onitemcommand="EmployeesRadGrid_ItemCommand">
                       <GroupingSettings CaseSensitive="False" />
                       <ExportSettings HideStructureColumns="true" FileName="Employees" Excel-Format="Biff"
                           OpenInNewWindow="false" Excel-FileExtension="xls" IgnorePaging="true" ExportOnlyData="false" />
                       <MasterTableView EditMode="PopUp" AllowFilteringByColumn="true" AllowSorting="true"
                           CommandItemDisplay="Top">
                           <CommandItemSettings ShowExportToExcelButton="true" ExportToExcelText="Export to Excel"
                               ShowAddNewRecordButton="false" />
                           <Columns>
                               <telerik:GridHyperLinkColumn DataNavigateUrlFields="PersonnelNo" UniqueName="Edit"
                                   AllowFiltering="false" DataNavigateUrlFormatString="EditEmployee.aspx?PersonnelNo={0}"
                                   Text="Edit" >
                               </telerik:GridHyperLinkColumn>
                               <telerik:GridCalculatedColumn HeaderTooltip="*= override" Expression="IsOverriden?  Convert.ToChar(42): Convert.ToChar(32)"
                                   AllowFiltering="false">
                               </telerik:GridCalculatedColumn>
                               <telerik:GridBoundColumn DataField="RacfID" HeaderText="RACF ID" CurrentFilterFunction="Contains"
                                   FilterControlWidth="4em" AutoPostBackOnFilter="true" ShowFilterIcon="true" >
                               </telerik:GridBoundColumn>
                               <telerik:GridBoundColumn DataField="FullName" HeaderText="Name" CurrentFilterFunction="Contains"
                                   AutoPostBackOnFilter="true" >
                               </telerik:GridBoundColumn>
                               <telerik:GridBoundColumn DataField="PositionName" HeaderText="Job Title" CurrentFilterFunction="Contains"
                                   FilterControlToolTip="Enter search value and press Tab or Enter" FilterControlWidth="9em"
                                   AutoPostBackOnFilter="true" >
                               </telerik:GridBoundColumn>
                               <telerik:GridBoundColumn DataField="PersonnelAreaDescription" HeaderText="Work Location"
                                   CurrentFilterFunction="Contains" FilterControlWidth="11em" AutoPostBackOnFilter="true"
                                   ShowFilterIcon="false">
                               </telerik:GridBoundColumn>
                               <telerik:GridBoundColumn DataField="OrgUnit" HeaderText="Org Unit" CurrentFilterFunction="Contains"
                                   FilterControlWidth="6em" AutoPostBackOnFilter="true">
                               </telerik:GridBoundColumn>
                               <telerik:GridBoundColumn DataField="BusinessSalesUnit" HeaderText="Sls-Bus Unit" FilterDelay="10000"
                                   FilterControlWidth="4em"  AutoPostBackOnFilter="true" >
                               </telerik:GridBoundColumn>
                               <telerik:GridBoundColumn DataField="DeptRegion" HeaderText="Dept-Region" CurrentFilterFunction="Contains"
                                   FilterControlWidth="4em" AutoPostBackOnFilter="true" >
                               </telerik:GridBoundColumn>
                               <telerik:GridBoundColumn DataField="CostCenterDisplay" HeaderText="Cost center" CurrentFilterFunction="Contains"
                                   FilterControlWidth="4em" AutoPostBackOnFilter="true" >
                               </telerik:GridBoundColumn>
                           </Columns>
                       </MasterTableView>
                   </telerik:RadGrid>


Thanks,
Alex

1 Answer, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 29 Nov 2012, 03:02 PM
Hi Alex,

Could you please elaborate a little bit more on your scenario? I was not able to reproduce your issue, so I prepared a small sample and attached it to this forum post. Give it a try and let me know what is the difference between my example and your project.

Regards,
Kostadin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Alex
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Share this question
or