62,046
社区成员
发帖
与我相关
我的任务
分享
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
<ItemTemplate>
<span style='<%# "color:" + (Eval("Sex").ToString()=="男" ? "White" : "Black")%>'><%#Eval("Sex")%></span><br />
</ItemTemplate>
</asp:Repeater>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=.\sqlexpress;Initial Catalog=Wish;Integrated Security=True" ProviderName="System.Data.SqlClient" SelectCommand="select sex from users"></asp:SqlDataSource>
<font color='<%#DataBinder.Eval(Container.DataItem,"Sex").ToString()=="男"?"white":"black"%>'><%#DataBinder.Eval(Container.DataItem,"Sex")%></font>
<font color='<%#DataBinder.Eval(Container.DataItem,"Sex").ToString()=="男"?"white":"black"%'>><%#DataBinder.Eval(Container.DataItem,"Sex")%></font>