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

Reset GanttView

2 Answers 75 Views
GanttView
This is a migrated thread and some comments may be shown as answers.
Nikola
Top achievements
Rank 1
Nikola asked on 10 Jun 2015, 10:27 AM

hi,

 

how does telerik remove GanttItems? I tried:

 

{

      myGantt.Items.Clear();

      // but this is throwing an exception

}

 

I have also tested several other Ideas, for example puttin BeginUpdate() - EndUpdate(), before and after Clearing() or Disposing(). 

In one of these techniques that I used, I also got an nullEXP from telerik itself. To make it understandable, not my code is throwing that!

I am working with GanttViewDataItems.

I would appreciate any kind of help

 

Thank you

2 Answers, 1 is accepted

Sort by
0
Nikola
Top achievements
Rank 1
answered on 10 Jun 2015, 12:37 PM

I have encountered my problem!

 

I have created, in past, one GanttViewDataItem that holds all other GanttViewDataItems. I generate all GanttViewDataItems manually and set them the right properties I need. In general this method works, but when I want to reload or load another project, to represent different GanttViewDataItems, I got an nullEXCP from telerik (not thrown in my code). 

 

So what I am doing to clear the GanttView is simple, 

 

{

   myGantt.Items.Remove(myGantt.Items[0]);      

}

 

Also this method seems to work well until, I click into a GraphicalGanttItem (on the right side). I come from Austria so I am speaking german usually. Hope you can understand what the exception prints out, here is the copy of that ErrorMessage:

 

System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
   bei Telerik.WinControls.UI.GanttViewDataItem.OnNotifyPropertyChanged(PropertyChangedEventArgs e)
   bei Telerik.WinControls.RadObject.OnPropertyChanged(RadPropertyChangedEventArgs e)
   bei Telerik.WinControls.RadObject.RaisePropertyNotifications(RadPropertyValue propVal, Object oldValue, Object newValue, ValueSource oldSource)
   bei Telerik.WinControls.RadObject.SetValueCore(RadPropertyValue propVal, Object propModifier, Object newValue, ValueSource source)
   bei Telerik.WinControls.RadObject.SetValue(RadProperty property, Object value)
   bei Telerik.WinControls.UI.GanttViewDataItem.set_Current(Boolean value)
   bei Telerik.WinControls.UI.RadGanttViewElement.ClearSelection()
   bei Telerik.WinControls.UI.RadGanttViewElement.ProcessCurrentItem(GanttViewDataItem item)
   bei Telerik.WinControls.UI.RadGanttViewElement.ProcessSelection(GanttViewDataItem item)
   bei Telerik.WinControls.UI.BaseGanttViewBehavior.ProcessMouseDown(MouseEventArgs e)
   bei Telerik.WinControls.UI.RadGanttViewElement.ProcessMouseDown(MouseEventArgs e)
   bei Telerik.WinControls.UI.RadGanttView.OnMouseDown(MouseEventArgs e)
   bei System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
   bei System.Windows.Forms.Control.WndProc(Message& m)
   bei System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   bei Telerik.WinControls.RadControl.WndProc(Message& m)
   bei Telerik.WinControls.UI.RadGanttView.WndProc(Message& m)
   bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

 

Now my question is, am I doing something wrong or is this just a simple bug from the telerik side?

Greets Niko

0
Polya
Telerik team
answered on 12 Jun 2015, 09:44 AM
Hi Nikola,

The NullReferenceException is probably caused because either myGantt.Items is empty or null or the myGantt.Items[0] doesn't exist (empty myGantt.Items). Is myGantt of type RadGanttView because the RadGanttView does not provide a property Items.

At this point we can only speculate what the problem might be. I suggest opening a support thread and attaching a sample project demonstrating the issue so we can investigate.

Also I've prepared a sample project that adds and removes GanttTasks from the collection used as TasksSource for the RadGanttView. If applicable in your scenario you can try this approach in your project.

Looking forward to your reply.

Regards,
Polya
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
GanttView
Asked by
Nikola
Top achievements
Rank 1
Answers by
Nikola
Top achievements
Rank 1
Polya
Telerik team
Share this question
or