Exception Scrolling Grid

5 posts, 0 answers
  1. Aaron
    Aaron avatar
    7 posts
    Member since:
    Feb 2012

    Posted 13 Feb 2012 Link to this post

    I am getting the following exception when scrolling a self referencing hierarchy grid.  I am using version 2010.3.10.1215.  Any suggestions or tips for working around this issue?

    This only occurs after I expand the rows with:
    WorkItemOneHopGridView.TableElement.BeginUpdate();
     
    foreach (GridViewDataRowInfo row in WorkItemOneHopGridView.ChildRows)
    {
        row.IsExpanded = true;
    }
     
    WorkItemOneHopGridView.TableElement.EndUpdate();


    System.NullReferenceException was unhandled
      Message=Object reference not set to an instance of an object.
      Source=Telerik.WinControls.GridView
      StackTrace:
           at Telerik.WinControls.UI.GridTraverser.StepInHierarchyBackward()
           at Telerik.WinControls.UI.GridTraverser.MovePreviousCore()
           at Telerik.WinControls.UI.GridTraverser.MovePrevious()
           at Telerik.WinControls.UI.ItemScroller`1.ScrollUp(Int32 step)
           at Telerik.WinControls.UI.ItemScroller`1.thumbTimer_Tick(Object sender, EventArgs e)
           at System.Windows.Forms.Timer.OnTick(EventArgs e)
           at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
           at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
           at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(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(Form mainForm)
           at WorkItemWizard.Program.Main() in C:\TFS\WorkItemWizard\Program.cs:line 33
           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()
      InnerException:
  2. Aaron
    Aaron avatar
    7 posts
    Member since:
    Feb 2012

    Posted 13 Feb 2012 Link to this post

    It looks like this is fixed in the most recent version of the control (I already knew that before I tried it).  I'm thinking at this point I will just disable the ability to expand and collapse the grid.  Since upgrading is not an option for me at this time, I will have to go this route.  I'm bummed that I ran into this bug but I have already put too much time into trying to work around it.  I found that the expand and collapse was very slow, so this might be best anyway (even with the most recent version).  If anybody has thoughts on a work around, I would be happy to hear about it.
  3. Aaron
    Aaron avatar
    7 posts
    Member since:
    Feb 2012

    Posted 13 Feb 2012 Link to this post

    Well, all I can say now is to never give up.  I was about to pull the buttons off my form when I gave it one more go.  I just fixed the problem with the following simple code:

    if (row.ChildRows.Count != 0)
    {
         row.IsExpanded = true;
    }



    The fix really was just that, apparently HasChildRows() is not working as intended in this version.  I had tried that before but apparently that wasn't enough.

    Here is a bit more:

    foreach (GridViewDataRowInfo row in this.WorkItemOneHopGridView.ChildRows.Cast<GridViewDataRowInfo>().Where(row => row.Cells["WorkItemId"].Value.ToString().StartsWith("P")))
    {
        if (row.ChildRows.Count != 0)
        {
            row.IsExpanded = true;
        }
    }

     

    Essentially the idea is, don't set the row to isExpanded if it doesn't have children or an exception is thrown.  This shouldn't be an issue in later versions as this has been fixed.

     

     

  4. Aaron
    Aaron avatar
    7 posts
    Member since:
    Feb 2012

    Posted 13 Feb 2012 Link to this post

    This also has seemed to fix the speed of expanding and collapsing as well.  Scrolling is also super fast!
  5. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 15 Feb 2012 Link to this post

    Hi Aaron,

    Thank you for writing.

    Indeed, we did have some issues with previous versions of RadGridView. However, with every release we are improving the control and its functionalities. As you mentioned, the experienced issues no longer exist in our latest build. I would recommend that you upgrade to our latest version Q1 2012 which we have just released. Since you are using Q3 2010, the upgrade will not be hard to achieve. Basically the controls that have changes are the following:
    - RadTreeView - refactored. Some breaking changes exist.
    - RadComboBox - removed from codebase, use RadDropDownList instead. Conversion tool available.
    - RadListBox- removed from codebase, use RadListControl instead. Conversion tool available.  
    - RadPanelBar - removed from codebase, use RadPageView instead. Conversion tool available. 
    - RadTabStrip- removed from codebase, use RadPageView instead. Conversion tool available.  

    - RadToolStrip -removed from codebase, use RadCommandBar instead. No conversion tool.
    - DockingManager is removed from code base, use RadDock instead. Conversion tool available.

    I hope that you find this information helpful. If you have any questions during the upgrade process, do not hesitate to contact us.

    Regards,
    Stefan
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top