0

次のようにlinqクエリから取得した変数に基づいて個々のセルに色を付けようとして、asp.net 3.5にplexityhideのGTP.NETを使用した人はいますか?

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

if ステートメントの構文は、彼らが推奨したものであり、誰でもこれを手伝うことができます

どうもありがとう

4

2 に答える 2

1

CellLayout.BackgroundUse=trueを設定していることを確認してください。そうしないと、背景色は無視されます。

また、ASP.NETを使用しているため、cellLayoutsはcssを生成するため、新しい複製されたCellLayoutsをCellLayoutsのコレクションに追加する必要があります。

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

于 2009-08-04T09:19:41.003 に答える