特色栏目

ASP源码

PHP源码

.NET源码

JSP源码

游戏频道
专题合集
关闭菜单
首页> ASP.NET教程> 在DataGrid里面根据日期的不同显示new图标

在DataGrid里面根据日期的不同显示new图标

时间:2009-06-30 15:49:34 作者:互联网

第一步:这样写Sql语句:

select  top 5  PK_Rntol_ID,Title,RenoDate,Promulgator,Flag=case
when getdate() - RenoDate < 5 then '1'
else '0'
end
from es***ypzb.T_Info_Rntol where RenoKind= @type order by RenoDate desc

第二步:

在DataGrid的DataBound()方法里面:

///


  /// 根据日期的多少,决定是否显示new图标
  ///

  ///
  ///
  private void wgrd_Info_ItemDataBound(object sender, Sy***m.Web.UI.WebControls.DataGridItemEventArgs e)
  {
   if(e.***m.ItemType == Li***temType.Item || e.***m.ItemType == Li***temType.AlternatingItem)
   {
    if(e.***m.Cells[5].Text == "1")
    {
     e.***m.Cells[1].Text = e.***m.Cells[1].Text + " ";
    }
   }
  }

 

相关文章 最新文章

相关应用

热门文章

猜你喜欢

返回顶部