本文介绍了在GridView中为新工程图显示的标志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个GridView,其中一栏是Drawigns&发布日期.
现在,我想要的是在图纸发布之前显示新标志" ,该图纸可以发布到最近2天.


谁能帮我解决这个问题?

Hi,



I have a GridView , in that one of the column is Drawigns & Release Date.
Now, what i want is i want to display "New Flag" before the Drawing which are released upto last 2 days.


can any one help me how to solve this issue

推荐答案

protected void gridview1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
         if (e.Row.RowType == DataControlRowType.DataRow)
         {
             DataRow row = ((DataRowView)e.Row.DataItem).Row;
            if(row.Field<string>("Column1").ToString().Equals("Your Value")
          {
                           e.Row.Cells["NewColumn"].Text = "Flag";
          }
           }
      }


protected void gridview1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        DateTime today = DateTime.Now;
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            DataRow row = ((DataRowView)e.Row.DataItem).Row;
            if(Convert.ToDateTime(e.Row.Cells["Column1"])-today < 2)
            {
                    e.Row.Cells["NewColumn"].Text ="Flag";
            }
        }
    }


这篇关于在GridView中为新工程图显示的标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 14:26