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

Null Filter Object reference not set to an instance of an object

2 Answers 222 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 07 Feb 2014, 10:42 PM
Hi All,

I have a basic RadGrid with GridDateTimeColumns and GridBoundColumns.  Unfortunately, when I try to filter these columns I receive an "Object reference not set to an instance of an object." error.  Reading the remainder of the error message, it appears that it is a "NullReferenceException."  These columns do have empty (null) values, so I believe the error stems from this.

Can anyone please tell me how I can go about fixing this error?

Thanks,
Mark

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 10 Feb 2014, 04:00 AM
Hi Mark,

Its hard to identify the issue without your code, below is a sample code snippet which works fine at my end. Please check if it works, else provide your full code.

ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="true" AllowPaging="true". .>
    <MasterTableView>
        <Columns>
            <telerik:GridBoundColumn DataField="OrderID" HeaderText="OrderID">
            </telerik:GridBoundColumn>
            <telerik:GridDateTimeColumn DataField="OrderDate" HeaderText="OrderDate" PickerType="DatePicker" EnableTimeIndependentFiltering="true" DataFormatString="{0:MM/dd/yyyy}">
            </telerik:GridDateTimeColumn>
            <telerik:GridBoundColumn DataField="ShipCity" HeaderText="ShipCity" >
            </telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

Thanks,
Princy
0
Mark
Top achievements
Rank 1
answered on 12 Feb 2014, 11:50 PM
Princy,

Thank you very much for the reply!

I was actually doing some custom filtering in my itemcommand method and didn't check to see if data from the filter pair was null before moving forward.

Thanks,
Mark
Tags
Grid
Asked by
Mark
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Mark
Top achievements
Rank 1
Share this question
or