<asp:BoundColumn DataField="Pl1" ItemStyle-ForeColor=<%# DataBinder.Eval(Container.DataItem,"Color") %>ItemStyle-Width="40"></asp:BoundColumn>
编译器错误信息: CS0117: “System.Web.UI.WebControls.BoundColumn”并不包含对“DataBinding”的定义
使用模板
假设设定该列为BLUE
<asp:BoundColumn DataField="Time" ReadOnly="True" HeaderText="时间" FooterText="时间">
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle Font-Size="Small" HorizontalAlign="Center" ForeColor="Blue"></ItemStyle>
<FooterStyle VerticalAlign="Middle"></FooterStyle>
</asp:BoundColumn>
如果你要动态改变行的颜色
for (int i=1;i<DataGrid1.Columns.Count;i=i+2)
{
DataGrid1.Columns[i].ItemStyle.BackColor=ColorTranslator.FromHtml("你的颜色");
}
应该是<asp:BoundColumn DataField="Pl1" ItemStyle-ForeColor=<%# DataBinder.Eval(Container.DataItem,"Color") %>ItemStyle-Width="40"></asp:BoundColumn>
也可以是<asp:BoundColumn DataField="Pl1" >
<Ttemp ForeColor=<%# DataBinder.Eval(Container.DataItem,"Color") %> Text=###/>
</asp:BoundColumn>
如果要的话,明天给你源码!!发消息给我
我要,ere_fan@163.com
谢谢了先:)
up