/ / Gantt-Diagramme - c #, asp.net, Diagramme, Gantt-Diagramm

Gantt-Diagramme - c #, asp.net, Diagramme, Gantt-Diagramm

Hat jemand plexityhides GTP.NET für asp.net 3.5 verwendet, als versuche ich, die einzelnen Zellen basierend auf einer var zu färben, die sich aus einer linq-Abfrage ergibt, wie folgt

PilotDataContext pilot = new PilotDataContext();

var schedule = from x in pilot.slot_tbl_Schedules select x;

foreach (var s in schedule)
{
if (s.AppointmentType == "Repair")
{
CellLayout cl = gn.GetCell(0).Layout.Clone() as CellLayout;
gn.GetCell(0).Layout = cll;
cl.BackgroundColor = Color.Red;
cl.SelectedColor = Color.Red;
}
else if (s.AppointmentType == "Service")
{
CellLayout cl = gn.GetCell(0).Layout.Clone() as CellLayout;
gn.GetCell(0).Layout = cl;
cl.BackgroundColor = Color.Blue;
}
else if (s.AppointmentType == "TravelTime")
{
CellLayout cl = gn.GetCell(0).Layout.Clone() as CellLayout;
gn.GetCell(0).Layout = cl;
cl.BackgroundColor = Color.Green;
}
else if (s.AppointmentType == "AnnualLeave")
{
CellLayout cl = gn.GetCell(0).Layout.Clone() as CellLayout;
gn.GetCell(0).Layout = cl;
cl.BackgroundColor = Color.Yellow;
}
}

Die Syntax in der if-Anweisung ist das, was sie empfohlen haben

Danke vielmals

Antworten:

1 für die Antwort № 1

Stellen Sie sicher, dass Sie CellLayout.BackgroundUse = true festlegen. Wenn Sie dies nicht tun, wird die Hintergrundfarbe ignoriert.

Und da Sie ASP.NET verwenden, generieren die cellLayouts eine css. Sie müssen also die neuen geklonten CellLayouts zur Sammlung auf CellLayouts hinzufügen:

Gantt_ASP.Gantt.Grid.CellLayouts.Add (cl);


0 für die Antwort № 2
Dim cl2 As CellLayout = TryCast(e.GridNode.GetCell(4).Layout.Clone(), CellLayout)

cl2.SelectedColor = Color.Red
cl2.FontColor = Color.Red
cl2.BackgroundColor = Color.Blue
cl2.BackgroundUse = True " when is true background color change
e.GridNode.GetCell(4).Layout = cl2

es funktioniert gut ..... :)