Link to home
Start Free TrialLog in
Avatar of Donnie4572
Donnie4572Flag for United States of America

asked on

CSS Style Sheet

I have web app. VB.Net. Four controls on aspx page. Sqlconnection, Dataadapter, Dataset, and Datagrid. The data on the grid is from sql2000 and each record has a date assigned to it. Each record represents appointment made by customer. I need the record s from the past to show up as the color red.

Example: If appointment is made for today 11/10/2004
              Then on 11/11/2004, on the grid, turn that record red.

Thanks,
Donnie
ASKER CERTIFIED SOLUTION
Avatar of iboutchkine
iboutchkine

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Donnie4572

ASKER

iboutchkine, thanks for reply.

Ok, this code  works only I can't get it to work with datetime column. Can someone show me how to use this code for my datetime field?

<asp:datagrid id="datagrid1" runat="server" OnItemDataBound="myformatrow" AutoGenerateColumns="False" Height="99.7%" Width="99.7%" AllowSorting="True">

 Protected Sub myformatrow(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs)
        If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
        Dim mycol As String = Convert.ToString(e.Item.Cells(2).Text)
        If mycol = "mydata" Then
        e.Item.ForeColor = Color.Red
      End If
    End If
End Sub

Thanks,
Donnie
Well it turns out this does work.
If mycol = "10/15/2004 9:00:00 AM" Then

The problem was 10/15/2004 09:00:00 AM  I suppose the 09 needed to 9 since it was converted to string.

Will award points for effort
Donnie