Completed
Last Updated: 26 Feb 2018 09:17 by Dimitar
ADMIN
Hristo
Created on: 22 Dec 2017 09:03
Category: Scheduler/Reminder
Type: Bug Report
0
FIX. RadScheduler - InvalidCastException when deleting a not visible resource from a grouped day view element
How to reproduce:
public partial class RadForm1 : Telerik.WinControls.UI.RadForm
{
    public RadForm1()
    {
        InitializeComponent();

        Resource resource1 = new Resource();
        resource1.Id = new EventId(1);
        resource1.Name = "Resource 1";
        resource1.Color = Color.Blue;

        Resource resource2 = new Resource();
        resource2.Id = new EventId(2);
        resource2.Name = "Resource 2";
        resource2.Color = Color.Green;

        Resource resource3 = new Resource();
        resource3.Id = new EventId(3);
        resource3.Name = "Resource 3";
        resource3.Color = Color.Red;

        this.radScheduler1.Resources.Add(resource1);
        this.radScheduler1.Resources.Add(resource2);
        this.radScheduler1.Resources.Add(resource3);
    }

    private void RadForm1_Load(object sender, EventArgs e)
    {
        this.radScheduler1.GroupType = GroupType.Resource;
        ((SchedulerViewGroupedByResourceElementBase)this.radScheduler1.ViewElement).ResourceStartIndex = 2;
    }

    private void radButton1_Click(object sender, EventArgs e)
    {
        this.radScheduler1.Resources.RemoveAt(0);
    }
}


Workaround: 
public partial class RadForm1 : Telerik.WinControls.UI.RadForm
{
    public RadForm1()
    {
        InitializeComponent();

        Resource resource1 = new Resource();
        resource1.Id = new EventId(1);
        resource1.Name = "Resource 1";
        resource1.Color = Color.Blue;

        Resource resource2 = new Resource();
        resource2.Id = new EventId(2);
        resource2.Name = "Resource 2";
        resource2.Color = Color.Green;

        Resource resource3 = new Resource();
        resource3.Id = new EventId(3);
        resource3.Name = "Resource 3";
        resource3.Color = Color.Red;

        this.radScheduler1.Resources.Add(resource1);
        this.radScheduler1.Resources.Add(resource2);
        this.radScheduler1.Resources.Add(resource3);
    }

    private void RadForm1_Load(object sender, EventArgs e)
    {
        this.radScheduler1.GroupType = GroupType.Resource;
        ((SchedulerViewGroupedByResourceElementBase)this.radScheduler1.ViewElement).ResourceStartIndex = 2;
    }

    private void radButton1_Click(object sender, EventArgs e)
    {
        this.radScheduler1.GroupType = GroupType.None;
        this.radScheduler1.Resources.RemoveAt(0);
        this.radScheduler1.GroupType = GroupType.Resource;
    }
}
0 comments