设为首页 加入收藏 网站搜索 繁體中文 中国建站网 — 站长资源分享平台

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

来源:网络收集 作者:佚名 时间:2007-04-25 23:01:43

第一步:这样写Sql语句:

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

第二步:

在DataGrid的DataBound()方法里面:

/// <summary>
  /// 根据日期的多少,决定是否显示new图标
  /// </summary>
  /// <param name="sender"></param>
  /// <param name="e"></param>
  private void wgrd_Info_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
  {
   if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
   {
    if(e.Item.Cells[5].Text == "1")
    {
     e.Item.Cells[1].Text = e.Item.Cells[1].Text + " <img src=/images/NullPic.gif>";
    }
   }
  }

Tags:

  • 好的评价 如果您觉得好,就请您
      0%(0)
  • 差的评价 如果您觉得差,就请您
      0%(0)
  • 相关文章
    广告赞助

    文章随便看看 设计素材 建站学院 网页模板 视频教程

    网友评论

    共有 0 位网友发表了评论,得分 0 分,平均 0 分    查看完整评论

    用户名: 查看更多评论

    分 值:100分 85分 70分 55分 40分 25分 10分 1分

    内 容:

             通知管理员 验证码: