2009-06-24 203 views
0

有没有人使用plexityhide的GTP.NET为asp.net 3.5作为即时通讯试图颜色基础上,即时通讯从LINQ查询得到一个变种的单个细胞如下甘特图

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

如果语法中声明是他们什么建议任何人都可以在这个

非常感谢帮助

回答

1

确保您设置CellLayout.BackgroundUse =真。如果你不这样做,背景颜色将被忽略。

既然你使用ASP.NET的cellLayouts会生成一个css,所以你必须添加新的克隆CellLayouts到集合上CellLayouts:

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 

它的正常工作...... :)