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

LoadLayout Object Reference issue

4 Answers 162 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Richard Slade
Top achievements
Rank 2
Richard Slade asked on 16 Jul 2009, 01:51 PM
Hello,

I am using on every grid view in our application LoadLayout and SaveLayout.

On most grids all works fine, but on one of our grids I am getting a NullReferenceException.


The grid has a lot of columns and includes look up columns. When I try and load the layout for this particular grid, I am getting the following NullReferenceException

Object reference not set to an instance of an object.

at Telerik.WinControls.Data.FilterExpressionCollection.GetFieldByName(String fieldName)

at Telerik.WinControls.Data.FilterExpression.set_Owner(FilterExpressionCollection value)

at Telerik.WinControls.Data.FilterExpressionCollection.InsertItem(Int32 index, FilterExpression item)

at System.Collections.ObjectModel.Collection`1.Add(T item)

at Telerik.WinControls.Data.Field.set_Filter(FilterExpression value)

at Telerik.WinControls.Data.Field.Initialize(Field field)

at Telerik.WinControls.UI.GridViewDataColumn.set_Field(Field value)

at Telerik.WinControls.Data.DataAccessComponent.EnsureColumns()

at Telerik.WinControls.Data.DataAccessComponent.UpdateColumns(NotifyCollectionChangedEventArgs e)

at Telerik.WinControls.UI.GridViewTemplate.UpdateColumns(NotifyCollectionChangedEventArgs e)

at Telerik.WinControls.UI.GridViewColumnCollection.NotifyListenersCollectionChanged(NotifyCollectionChangedEventArgs e)

at Telerik.WinControls.Data.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)

at Telerik.WinControls.Data.ObservableCollection`1.EndUpdate(Boolean notifyUpdates)

at Telerik.WinControls.Data.ObservableCollection`1.EndUpdate()

at Telerik.WinControls.UI.GridViewLayoutSerializer.ProcessListOverride(XmlReader reader, Object listOwner, PropertyDescriptor ownerProperty, IList list)

at Telerik.WinControls.XmlSerialization.ComponentXmlSerializer.ReadElementInObject(XmlReader reader, PropertyDescriptor property, Object toRead)

at Telerik.WinControls.XmlSerialization.ComponentXmlSerializer.ReadObjectElement(XmlReader reader, Object parentObject, Object toRead)

at Telerik.WinControls.XmlSerialization.ComponentXmlSerializer.ReadElementInObject(XmlReader reader, PropertyDescriptor property, Object toRead)

at Telerik.WinControls.XmlSerialization.ComponentXmlSerializer.ReadObjectElement(XmlReader reader, Object parentObject, Object toRead)

at Telerik.WinControls.XmlSerialization.ComponentXmlSerializer.ReadObjectElement(XmlReader reader, Object toRead)

at Telerik.WinControls.UI.RadGridView.LoadLayout(String fileName)

at Multepos.Controls.GridView.LoadLayout(GridViewName gridViewName) in C:\Users\Richard\Documents\Visual Studio 2005\Projects\Multepos.Controls\GridView\GridView.vb:line 392

at Multepos.HeadOffice.UI.Forms.FileAdmin.Master.Master_Shown(Object sender, EventArgs e) in C:\Users\Richard\Documents\Visual Studio 2005\Projects\Multepos.HeadOffice.UI\Forms\File Admin\Master.vb:line 69

at System.Windows.Forms.Form.OnShown(EventArgs e)

at System.Windows.Forms.Form.CallShownEvent()

at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)

at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)

at System.Threading.ExecutionContext.runTryCode(Object userData)

at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)

at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)

4 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 16 Jul 2009, 03:20 PM
This is now solved and wasn't an issue with LoadLayout.
It was an issue with one of the LookupColumns for filtering. I commented out the data value member and display member declarations from the designer, ran it and commented it back in again and all worked fine. Must be VS playing up.
Thanks anyway
0
Jack
Telerik team
answered on 17 Jul 2009, 10:22 AM
Hello Richard Slade,

I am glad to hear that you have found a solution to this issue. If you face it again, please send us your application and we will try to locate and address the issue. If you have any other questions, don't hesitate to ask.

Kind regards,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Yas
Top achievements
Rank 1
answered on 23 Aug 2012, 08:31 AM

Hi Richard

I have same your  problem .I declare valuemember and displaymember before allocate datasource of grid .but have this problem again.

((GridViewMultiComboBoxColumn)GrdItm.Columns["AccCode"]).ValueMember = "DlCode";
((GridViewMultiComboBoxColumn)GrdItm.Columns["AccCode"]).DisplayMember = "DlCode";
((GridViewMultiComboBoxColumn)GrdItm.Columns["AccCode"]).DataSource = DtAccount;

 GrdItm .datasource=dt;

can you help me? 

0
Jack
Telerik team
answered on 27 Aug 2012, 02:50 PM
Hello Yas,

I am not able to reproduce the described issue using our latest release - Q2 2012 SP1. Please, could you send us your application, so we can debug and locate the issue. Thank you in advance.

I am looking forward to your reply.
 
Greetings,
Jack
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Tags
GridView
Asked by
Richard Slade
Top achievements
Rank 2
Answers by
Richard Slade
Top achievements
Rank 2
Jack
Telerik team
Yas
Top achievements
Rank 1
Share this question
or