I am converting an app to RadGrid controls, and I would like advice on the best way to convert some code that I had running in a DataGrid's RowDataBound event:
Basically the code changes the color of the due date to let the user know what is late. The last bit changes the background color if an alert message exists.
Thanks for your help!
Private Sub gvAvailableTasks_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvAvailableTasks.RowDataBound If Not gvAvailableTasks.SelectedRow Is Nothing Then If gvAvailableTasks.SelectedRow.ID = e.Row.ID Then Exit Sub End If End If If e.Row.RowType = DataControlRowType.DataRow Then Dim dd As DateTime dd = CType(e.Row.Cells(6).Text, DateTime) If dd < Date.Now Then e.Row.Cells(6).BackColor = Drawing.Color.Red Else If DateDiff(DateInterval.Hour, Date.Now, dd) < 5 Then e.Row.Cells(6).BackColor = Drawing.Color.Orange ElseIf DateDiff(DateInterval.Hour, Date.Now, dd) < 9 Then e.Row.Cells(6).BackColor = Drawing.Color.Yellow End If End If ' Alert message Dim s As String = e.Row.Cells(5).Text If s.Trim <> " " And s.Trim <> "" Then e.Row.Cells(5).BackColor = Drawing.Color.Yellow End If End If End SubBasically the code changes the color of the due date to let the user know what is late. The last bit changes the background color if an alert message exists.
Thanks for your help!