Repeater formats the data

  • 2020-05-27 04:45:22
  • OfStack

But it's inconvenient. In fact, we can use the following two methods:

3 yuan expression:


<td><%# int.Parse(Eval("price").ToString()) > 3600 ? "<a>#</a>" : Eval("price").ToString()%></td>

Background method return:


public string ReturnStr(string str)
    {
        if (string.IsNullOrEmpty(str))
            return "";
        if (str == "Iphone4s")
            return "<a>Iphon5</a>";
        else
            return str;
    }
<td><%# ReturnStr(Eval("productName").ToString())%></td>

How easy it is. 1 general daily data formatting can be completed, do not need to control the research


Related articles: