I am using the latest Q2 release of 2013 .NET version 4.5.
I have a method that creates a grid programmatically. This method is called on Page_Init wherever it is used. Grid is created and works just fine as long as I do not add "AllowFilteringByColumn = true". Here is the body of the method:
I have methods to create the columns, which are added to the master table view column collection:
The datasource on the grid is set as follows:
Finally, the grid is added to an ASP Panel placeholder (happens in Page_Init).
I get the following error when having AllowFilteringByColumn = true:
Server Error in '/' Application.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Stack Trace:
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18045
I have a method that creates a grid programmatically. This method is called on Page_Init wherever it is used. Grid is created and works just fine as long as I do not add "AllowFilteringByColumn = true". Here is the body of the method:
RadGrid grid = new RadGrid();grid.ID = "CustomViewGrid";grid.AllowFilteringByColumn = true;grid.AutoGenerateColumns = false;grid.AllowPaging = true;grid.AllowSorting = true;grid.PageSize = view.PageSize;grid.ClientSettings.Scrolling.AllowScroll = true;grid.ClientSettings.Scrolling.SaveScrollPosition = true;grid.ClientSettings.Scrolling.ScrollHeight = Unit.Pixel( 500 );grid.ClientSettings.Scrolling.UseStaticHeaders = true;grid.ClientSettings.Selecting.AllowRowSelect = true;grid.ClientSettings.Selecting.UseClientSelectColumnOnly = true;grid.AllowMultiRowSelection = true;grid.GroupingSettings.CaseSensitive = false;grid.PagerStyle.Mode = GridPagerMode.NextPrevNumericAndAdvanced;grid.MasterTableView.AutoGenerateColumns = false;grid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;grid.MasterTableView.DataKeyNames = new string[] { view.TableKeyName };return grid;I have methods to create the columns, which are added to the master table view column collection:
GridBoundColumn column = new GridBoundColumn();column.DataField = dataField;column.UniqueName = dataField;column.AllowFiltering = true;column.CurrentFilterFunction = GridKnownFunction.Contains;column.FilterControlWidth = Unit.Pixel(100);column.ItemStyle.Width = Unit.Pixel(120);column.HeaderStyle.Width = Unit.Pixel(120);column.AutoPostBackOnFilter = true;column.ShowFilterIcon = false;return column;The datasource on the grid is set as follows:
EntityDataSource dataSource = new EntityDataSource();dataSource.ID = "CustomViewGridDataSource";dataSource.EntitySetName = view.TableName;dataSource.ContextCreating += dataSource_ContextCreating; // set the object context here since I am using code-first EF5.0dataSource.Where = view.Filter;grid.DataSource = dataSource;Finally, the grid is added to an ASP Panel placeholder (happens in Page_Init).
I get the following error when having AllowFilteringByColumn = true:
Server Error in '/' Application.
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.
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:
|
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18045