"Object reference not set to an instance of an object." when radgridview is bound to new data

43 posts, 0 answers
  1. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 09 Dec 2009 Link to this post

    Hi DGPunkt,

    I am glad to hear that you have found a solution to this issue and I confirm that it exists in our latest release. I logged the issue in our bug tracking system and it will be addressed in the next release. I updated also your Telerik points.

    All the best,
    Jack
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  2. Sunil
    Sunil avatar
    230 posts
    Member since:
    Jan 2004

    Posted 10 May 2010 Link to this post

    Strange, but I get the same error using heirarchical grids, even when using Q1 2010 version. I would have thought that Telerik would have fixed this issue when it was discovered in an older release.
    I think, it's veryyyyyyyy difficult to upgrade when using Telerik Winform Controls. Their approach to new releases needs some big re-thinking.

    May be they need someone with a different thinking in their strategy team.
    It's very frustrating.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 13 May 2010 Link to this post

    Hello Sunil,

    I am not sure which issue are you targeting. If you need assistance, please specify the issue and we will be glad to help. We decided to concentrate our efforts on bug fixes for Q1 2010 and did not introduce new features. This allowed us to refactor several important parts of RadGridView. You can find more information about our upcoming release in this blog article.

    Sincerely yours,

    Jack
    the Telerik team

     


    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. Stefan
    Stefan avatar
    10 posts
    Member since:
    Feb 2009

    Posted 09 Jun 2010 Link to this post

    Hello,

    I'm using RadControls Q1 2010 SP1.

    I use a RadGridView "matgrid" bound to a List<MM_Materials>.
    MM_Materials is a poco. It has a member MM_MaterialVariants which is a List<MM_MaterialVariants>.
    MM_MaterialVariants is also a poco .

    I'm trying to set up a hierarchical grid. As soon as I try to expand a row with the '+'-Button, I get the obvously "well-known" null reference exception.

    //Creating the childTemplate 
     GridViewTemplate template = new GridViewTemplate(matgrid); 
     template.AutoGenerateColumns = false
     template.AllowDragToGroup = false
     template.AllowEditRow = false
     
     template.Columns.Add(new GridViewDataColumn("Material""Material")); 
     template.Columns.Add(new GridViewDataColumn("MaterialVariant""MaterialVariant")); 
     template.Columns.Add(new GridViewDataColumn("MaterialVariantStatus""MaterialVariantStatus")); 
                   
     matgrid.MasterGridViewTemplate.ChildGridViewTemplates.Add(template); 
     
    //Creating the relation 
     GridViewRelation relation = new GridViewRelation(matgrid.MasterGridViewTemplate); 
     relation.ChildTemplate = template; 
     relation.RelationName = "MaterialsMaterialVariants"
     relation.ParentColumnNames.Add("MaterialID"); 
     relation.ChildColumnNames.Add("Material"); 
     matgrid.Relations.Add(relation); 
     
    //Setting the Data Sources 
     matgrid.DataSource = materials; 
     matgrid.MasterGridViewTemplate.ChildGridViewTemplates[0].DataSource = materials; 
     matgrid.MasterGridViewTemplate.ChildGridViewTemplates[0].DataMember = "MM_MaterialVariants"

    I tried to write a new Class MyGridView, inheriting RadGridView. In this class I added an MouseDown-Event:

    protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e) 
       try 
       { 
         base.OnMouseDown(e); 
       } 
       catch 
       { 
           //Here the null reference exception occurs. Do nothing. 
       } 

    If I do it that way, I can continue working but have to click every '+'-Button twice to expand the child grid.

    Any (quick) help would be appreciated.

    Thank you.
    Stefan


  6. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 14 Jun 2010 Link to this post

    Hi Stefan,

    Currently, we do not support object-relational hierarchy and this scenario can't be implemented in RadGridView. However, this is one of the major features that we will present in our upcoming version - Q2 2010. 

    We want to know more about your scenario. Please give us more details and we will consider the case when developing our new feature. Thank you for your time.

    If you have any other questions, feel free to write back.

    Best wishes,
    Jack
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  7. Paul Patterson
    Paul Patterson avatar
    40 posts
    Member since:
    May 2010

    Posted 05 Aug 2010 Link to this post

    Folks, 

    I am having the same issue (as the original thread). This has something to do with the System.Collections.IList.get_Item(Int32 index). 

    I created a simple project using the example in the WinForms Q2 2010 help documentation (http://www.telerik.com/help/winforms/grid_binding-to-generic-lists.html) - binding to a simple generic collection of list. Ran the project and tried to add a new item...and kapowie (that's techie for WTF)...

       at System.ThrowHelper.ThrowArgumentOutOfRangeException()
       at System.Collections.Generic.List`1.System.Collections.IList.get_Item(Int32 index)
       at Telerik.WinControls.Data.RadListSource`1.InsertItem(Int32 index, TDataItem item)
       at Telerik.WinControls.Data.RadListSource`1.AddNew()
       at Telerik.WinControls.UI.GridViewNewRowInfo.EndAddNewRow()
       at Telerik.WinControls.UI.GridViewNewRowInfo.OnEndEdit()
       at Telerik.WinControls.UI.GridViewEditManager.FinishEditingOperation()
       at Telerik.WinControls.UI.GridViewEditManager.OnPositionChanging(Object sender, PositionChangingEventArgs args)
       at Telerik.WinControls.UI.EventDispatcher.RaiseEvent[T](Object eventKey, Object sender, T args)
       at Telerik.WinControls.UI.MasterGridViewTemplate.SetPositionCore(GridViewRowInfo newRow, GridViewColumn newColumn, GridViewRowInfo oldRow, GridViewColumn oldColumn, Boolean validateRowChange)
       at Telerik.WinControls.UI.MasterGridViewTemplate.SetPosition(GridViewRowInfo row, GridViewColumn column, Boolean notifyUserChangedCurrentRow, Boolean validateRowChange)
       at Telerik.WinControls.UI.MasterGridViewTemplate.SetPosition(GridViewRowInfo row, GridViewColumn column)
       at Telerik.WinControls.UI.BaseGridNavigator.SelectCore(GridViewRowInfo row, GridViewColumn column)
       at Telerik.WinControls.UI.BaseGridNavigator.SelectRow(GridViewRowInfo row)
       at Telerik.WinControls.UI.BaseGridNavigator.SelectNextColumn()
       at Telerik.WinControls.UI.GridRowBehavior.ProcessTabKey(KeyEventArgs keys)
       at Telerik.WinControls.UI.GridRowBehavior.ProcessKey(KeyEventArgs keys)
       at Telerik.WinControls.UI.BaseGridBehavior.ProcessKey(KeyEventArgs keys)
       at Telerik.WinControls.UI.RadGridView.ProcessDialogKey(Keys keyData)
       at System.Windows.Forms.TextBoxBase.ProcessDialogKey(Keys keyData)
       at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
       at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)
       at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)
       at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FPreTranslateMessage(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(ApplicationContext context)
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       at WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()

    Help?!?

  8. Paul Patterson
    Paul Patterson avatar
    40 posts
    Member since:
    May 2010

    Posted 05 Aug 2010 Link to this post

    My bad (yet again).

    Seems to be a .Net framework issue. I was using version 4. Changed the target framework to 3.5 and all seems ok now.

    Paul
  9. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 10 Aug 2010 Link to this post

    Hi Paul Patterson,

    I am glad to hear that your issue is solved now. If you have further questions or issues, do not hesitate to contact us back.

    Regards,
    Julian Benkov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  10. Versile
    Versile avatar
    20 posts
    Member since:
    May 2009

    Posted 19 Aug 2010 Link to this post

    I want to agree with the other posters. Every time Telerik releases an "upgrade" it might as well be a new control set. Major re-factoring, their "conversion" wizards don't work as advertised, and functions that used to work suddenly "break". While we have quite a bit built into Telerik and it's not wise for us to change products, at this point there's also no point in continuing a service agreement since it literally costs more than refactoring our code every upgrade. I hope Telerik does some serious thinking about this before they send out their next release.
  11. Prad
    Prad avatar
    35 posts
    Member since:
    Apr 2008

    Posted 19 Aug 2010 Link to this post

    Hello ,
     Try Clearing the Columns, filters, Conditional format and Grouping before loading GridView1.DataSource. I hope this will resolve your issue.

    Not a good work around though but works for me :)

    Prad
  12. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 24 Aug 2010 Link to this post

    Hi Prad,

    We still build our components upon .NET Framework v2.0. This allows those who rely on this framework to use our components without compatibility issues. Nevertheless, we want to be compatible will all new versions of the .Net framework and I want to thank you for this information. We will do tests and will investigate this case in detail.

    Versile, I am sorry to hear this. We always try to keep the breaking changes at minimum and we make changes only when they are necessary to improve our products. We are always ready to help you with the transition process and if there is an issue that you can not solve, please contact us and send us your application. We will make all changes for you.

    Pradeep, thank you for your solution. Please, describe what is the issue that forces you to use this work around. We will try to locate and address it.

    Regards,

    Jack
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  13. Prad
    Prad avatar
    35 posts
    Member since:
    Apr 2008

    Posted 24 Aug 2010 Link to this post

    Assume that your grid is loaded with Conditional, Filter (include groups as well) settings and then programatically set
    radGridView1.datasource = null; (bing... this is where it hits the exception).

    ** Note load these settings using layout structure (.LoadLayout). Do not create them @ Design time.

    You may not get this error for the first load of the application. Maybe repeated runs should get you this error.

    Let me know if this helps...

    Prad



  14. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 26 Aug 2010 Link to this post

    Hello Prad,

    Thank you for these details. We know about several issues related to the save/load layout functionality in RadGridView and currently we are working to finxing them. They will be addressed in our upcoming service pack in the beginning of September. However, I was not able to reproduce this particular issue. Please, could you send me a sample application that reproduces it (in a new support ticket)? This will ensure that the issue will be addressed in our service pack. Thank you in advance.

    I am looking forward to your project.

    Regards,
    Jack
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top
UI for WinForms is Visual Studio 2017 Ready