2009-06-24 20 views
0

は、誰もがガントチャート

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; 
    } 
} 

場合における構文を次のようにLINQクエリから取得イムVARに基づいて個々のセルに色をしようとしているイムとしてasp.net 3.5のplexityhideのGTP.NETを使用しています声明は、彼らは誰もが

答えて

1

あなたはCellLayout.BackgroundUse = trueを設定していることを確認します。この

多くのおかげで助けることができる推奨しているものです。あなたがしなければ、背景色は無視されます。

そして、あなたはASP.NETを使用するので、あなたがCellLayoutsのコレクションに新しいクローンCellLayoutsを追加する必要がありますのでcellLayoutsは、CSSを生成します。

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

0
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 

それは.....正常に動作しています:)

関連する問題