LoadLayout Object Reference issue

5 posts, 0 answers
  1. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 16 Jul 2009 Link to this post

    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)

  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 16 Jul 2009 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Jack
    Admin
    Jack avatar
    2333 posts

    Posted 17 Jul 2009 Link to this post

    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.
  5. Yas
    Yas avatar
    1 posts
    Member since:
    Aug 2012

    Posted 23 Aug 2012 Link to this post

    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? 

  6. Jack
    Admin
    Jack avatar
    2333 posts

    Posted 27 Aug 2012 Link to this post

    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 >>
Back to Top
UI for WinForms is Visual Studio 2017 Ready