0
我想檢查每行的單元格(3)中的日期。如果第一個If
條件成立,我只能得到日期,其餘的單元格顯示爲空白。代碼如下。如果語句在循環中的網格視圖
For Each row As GridViewRow In GridView1.Rows
If Not IsDBNull(dr("B1Week").ToString) Then
e.Row.Cells(3).Text = dr("B1week").ToString
e.Row.Cells(3).ForeColor = System.Drawing.Color.Blue
ElseIf DD2 <= Now Then
e.Row.Cells(3).Text = e.Row.Cells(3).Text & " - OVERDUE"
e.Row.Cells(3).ForeColor = System.Drawing.Color.Red
ElseIf DD2 <= Now.AddDays(7) Then
e.Row.Cells(3).Text = e.Row.Cells(3).Text & " - DUE "
e.Row.Cells(3).ForeColor = System.Drawing.Color.Green
End If
Next row
我希望檢查每行中的每個單元格3並分配值。誰能幫忙?
能告訴我該怎麼做,因爲目前的第一,如果正在顯示的條件如果爲真。如果第一個if爲false,則單元格顯示爲空白。 – user1764540
你看過上面的代碼嗎?我已經編輯它將e.Row.Cells(3)更改爲row.Cells(3)... –