1. The process of judging you can write in the background, such as the first in the background to write a public type method:
public bool Checkaduit (string code)
{
Judging by the code you passed in, and returning true or false
}
Then bind here to write:
<% #CheckAduit (convert.tostring (Eval (' Isaduit ')))%>
2. Write the ternary expression directly
<%# convert.tostring (Eval (' isaduit ')) = = "0"? " Is "?" No "%>
3. Replace in this repeater Datarowbind event.
<td><% string color = Eval ("Color"). ToString ();
switch (color)
{
Case "4A1":
Response.Write ("<font color= ' #5f1a1f ' >" + Eval
("Smalltype") + "<br/>" + Eval ("Othercolor") + "</font>");
Break
Case "4A2":
Response.Write ("<font color= ' #ba6525 ' >" + Eval
("Smalltype") + "<br/>" + Eval ("Othercolor") + "</font>");
Break
Case "4A3":
Response.Write ("<font color= ' #bd8256 ' >" + Eval
("Smalltype") + "<br/>" + Eval ("Othercolor") + "</font>");
Break
Case "4A8":
Response.Write ("<font color= ' #980808 ' >" + Eval
("Smalltype") + "<br/>" + Eval ("Othercolor") + "</font>");
Break
Case "4A11":
Response.Write ("<font color= ' #791418 ' >" + Eval
("Smalltype") + "<br/>" + Eval ("Othercolor") + "</font>");
Break
Case "4A14":
Response.Write ("<font color= ' #a32496 ' >" + Eval
("Smalltype") + "<br/>" + Eval ("Othercolor") + "</font>");
Break
Default
Response.Write ("" + Eval ("Smalltype") + "<br/>" +
Eval ("Othercolor") + "");
Break
}
%></td>
Special use of the Reapter control: Use the eval to asp:repeater the value of the binding inside to judge based on the data obtained from the database, and then display the desired content