0

我正在asp.net 3.5使用c#. 我正在获取dataset包含 name 字段的记录IsDeleted。现在对于这个字段,如果它设置为true然后我想删除整行的文本。

例如:我正在使用以下代码制作Capital Case字段文本:Alertlinq

ds.Tables[0].AsEnumerable().ToList().ForEach(i => i["Alert"] = System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(i["Alert"].ToString()));

这样的事情是可能的to strikeout the entire row's text?

谢谢

4

1 回答 1

1

显然TextInfo没有任何方法可以进行这种修改,因为它仅应用于 HTML。

但是,您可以将 HTML 添加text-decoration到每个单元格。试试这个:

ds.Tables[0].AsEnumerable().ToList()
          .Where(i=>i["IsDeleted"].ToString().Equals("True"))
          .ForEach(i => 
          {
              i["Alert"] = "<span style='text-decoration:line-through;'>" + 
                           i["Alert"].ToString() +
                           "</span>";
              i["Name"] = "<span style='text-decoration:line-through;'>" + 
                           i["Name"].ToString() +
                           "</span>";
              i["Date"] = "<span style='text-decoration:line-through;'>" + 
                           i["Date"].ToString() +
                           "</span>";
          });
于 2013-02-20T16:14:59.467 回答