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

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/zyl19940321/article/details/53212492

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

        }

展开阅读全文

没有更多推荐了,返回首页