我想要一个RowDataBound,如果之前在文件中登记的日期没有被发现是红色的
例如未找到日期10/10/2014,因此10/11/214为红色,如何将日期编辑为dd/mm/yyyy
谢谢你的帮助。
Name Checkin Checkout Branch
450 10/6/2014 9:13:38 AM 10/6/2014 6:01:50 PM branch0
450 10/7/2014 9:16:34 AM 10/7/2014 6:44:21 PM branch0
450 10/8/2014 9:11:53 AM branch0
450 10/8/2014 6:03:25 PM branch0
450 10/11/2014 9:17:33 AM 10/11/2014 6:29:16 PM branch0 (red color )
450 10/11/2014 4:50:42 PM branch0
450 10/12/2014 9:09:38 AM branch0发布于 2014-11-01 14:28:17
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GridView1.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.RowIndex <> 0 Then
Dim dt1 As DateTime = Convert.ToDateTime(Me.GridView1.Rows(e.Row.RowIndex - 1).Cells(1).Text, New CultureInfo("en-GB"))
Dim dt2 As DateTime = Convert.ToDateTime(e.Row.Cells(1).Text, New CultureInfo("en-GB"))
Dim timeSpan As TimeSpan = dt2.Subtract(dt1)
If timeSpan.TotalHours > 24 Then
e.Row.BackColor = Color.Red
End If
End If
End If
End Subhttps://stackoverflow.com/questions/26674620
复制相似问题