asp.net vb query on datagrid and coloring cells

Associate
Joined
24 May 2011
Posts
210
I am not expert in asp.net or web development but do a lot of vbscripting

I have this web page as an aspx file

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<html>
<script language="VB" runat="server">
Sub Page_Load(Src As Object, e As EventArgs)
Dim myConnection As SqlConnection
Dim myCommand As SqlDataAdapter
myConnection = New SqlConnection("server=localhost;" & "database=dbname;User ID=user;password=password")
myCommand = new SqlDataAdapter("select server AS 'Server', status AS 'Status',lastchecked AS 'Checkin Date & Time' from VMServerStatus", myConnection)
Dim ds As DataSet = new DataSet()
myCommand.Fill(ds)
MyDataGrid.DataSource = ds
MyDataGrid.DataBind()

End Sub
</script>
<body>
<ASPataGrid id="MyDataGrid" runat="server"
columnwidth="auto" BackColor="#ccccff"
BorderColor="black" ShowFooter="false"
CellPadding=3 CellSpacing="0"
Font-Name="Verdana" Font-Size="7pt"
HeaderStyle-BackColor="#aaaadd" EnableViewState="false"
/>
</aspataGrid>
</body>
</html>

The above displays a status of each server and works as I want to - pulls data from a backend SQL database and displays status of servers, now how do I go about coloring the row in red where the server status field is the text Faulty.
 
Back
Top Bottom