您的位置:首页 > 其它

repeater根据不同字段显示不同颜色

2016-11-18 09:16 330 查看
<td><asp:Label ID="Label" runat="server" ForeColor='<%#GetColor(Eval("examinestate").ToString())%>' Text='<%#DataBinder.Eval(Container.DataItem, "examinestate")%>'></asp:Label></td>

public System.Drawing.Color GetColor(string examinestate)

        {

            System.Drawing.Color colorvalue = new System.Drawing.Color();

            if (examinestate == "审核通过")

            {

                colorvalue = System.Drawing.Color.Green;

            }

            if (examinestate == "未审核")

            {

                colorvalue = System.Drawing.Color.Red;

            }

            if (examinestate == "退回")

            {

                colorvalue = System.Drawing.Color.Blue;

            }

 

            return colorvalue;

        }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: