when i click the filter feature it throws
"SPGridView_FilterCallbackErrorHandler() result = Object reference not set to an instance of an object"
somehow i cannot get any documentation for SPGridView_FilterCallbackErrorHandler() in msdn or google.
can someone help me thks.
this is part of my code in page_load
SPDataSource mySPDS = new SPDataSource();
SPSite siteCollection = SPContext.Current.Site;
SPWeb site = siteCollection.OpenWeb();
SPBoundField BField = new SPBoundField();
BField.DataField = "Title";
BField.HeaderText = "EmployeeNumber";
grdPropertyValues.AllowSorting = true;
grdPropertyValues.Columns.Add(BField);
SPBoundField BField1 = new SPBoundField();
BField1.HeaderText = "EmployeeName";
BField1.DataField = "EmployeeName";
grdPropertyValues.Columns.Add(BField1);
SPBoundField Bfield2 = new SPBoundField();
Bfield2.HeaderText = "EmployeeUserId";
Bfield2.DataField = "EmployeeUserId";
grdPropertyValues.Columns.Add(Bfield2);
mySPDS.List = SPContext.Current.Web.Lists["TestList"];
grdPropertyValues.AllowGrouping = false;
grdPropertyValues.AllowGroupCollapse = false;
grdPropertyValues.GroupField = "Title";
grdPropertyValues.GroupDescriptionField = "Title";
grdPropertyValues.GroupFieldDisplayName = "Programme";
grdPropertyValues.DataSource = mySPDS;
grdPropertyValues.FilteredDataSourcePropertyName = "FilterExpression";
grdPropertyValues.FilterDataFields = "Title";
grdPropertyValues.FilteredDataSourcePropertyFormat = "{1} LIKE '{0}'";
grdPropertyValues.AllowSorting = true;
grdPropertyValues.AllowFiltering = true;
grdPropertyValues.DataBind();
Thanks
Dave
By the way, on this code, I thing the DataBind method call should be moved in the PreRender ou Render method.
Can you check this article, This may help you. http://www.sharepointblogs.com/bobsbonanza/archive/2007/07/02/filtering-with-spgridview.aspx
The AJAX request launched when I open the filter menu of any header menu just returns "eObject reference not set to an instance of an object".
The reason is that I needed to give the DataSource in the CreateChildControls, before or in the OnPreRender was too late.
- Proposed as answer by John Guilbert Saturday, July 24, 2010 7:02 PM
Hi Florent,
I've tried implementing filtering using visual webpart, and i'm facing the same problem as you are.
My spgridview:
oGridView.AllowFiltering = true;
oGridView.FilterDataFields = "Name,Description,Price,QtyInStock,Value";
oGridView.FilteredDataSourcePropertyName = "FilterExpression";
oGridView.FilteredDataSourcePropertyFormat = "{1} LIKE '{0}'";
I'm using an IList<Business objects> as datasource with 4 SPBoundField and 1 SPMenuField
I keep getting object reference not set to an instance error...
Hi Gary,
I am in the exact same position as you were, 3 years later. Have you been able to solve this issue?? Thanks for any help!
- Edited by Florent Luckyer Thursday, February 20, 2014 9:18 AM
Hi,
Did u get any help for this problem?