救济。。。

comyj comyj 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我在做一个简单的新闻系统,现在用GridView绑定输出全部新闻及新闻时间全没问题了。我现在想加个功能 ,如果输出的这条新闻的存入日期就是当天日期,那么我想在输出日期时,用红色显示这个日期,怎么做呢??

就是这种形式:

<asp:GridView ID="UserView" Width="100%" runat="server" AutoGenerateColumns="False"
CellPadding="3" ForeColor="#333333" GridLines="None" HorizontalAlign="Center" AllowPaging="True" OnPageIndexChanging="UserView_PageIndexChanging" PageSize="15" OnDataBinding="UserView_DataBinding">
<Columns>

<asp:TemplateField HeaderText="新闻时间">
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text=<%#DataBinder.Eval(Container.DataItem,"timedate", "{0:g}") %>></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Left" VerticalAlign="Middle" Width="20%" />

</asp:TemplateField>


</Columns>

</asp:GridView>
...全文
评论 7
收藏 已收藏
分享
返回顶部
comyj
.NET社区 62,271 成员 668,968 内容