How to tell if a GridView row is empty

rsturner82

New member
Joined
Feb 1, 2010
Messages
2
Programming Experience
Beginner
I am making a .aspx page using visual studio 2005 and am putting data into a grid view via an sql connection. Code below:

Dim con As New Data.SqlClient.SqlConnection

If Not (Page.IsPostBack) Then
con.ConnectionString = "Data Source=GDT-SQL02\SQL02;Initial Catalog=CRSDataMirror413;User Id=DefSum;Password=cheet@r@;"
con.Open()

Dim sqlCommand As New Data.SqlClient.SqlCommand("SELECT boardclientmap.System, boardclientmap.clientcode, boardclientmap.reportcode, BoardBatch.PurchaseName FROM boardclientmap INNER JOIN BoardBatch ON Boardclientmap.reportcode = BoardBatch.reportcode ORDER by clientcode", con)
Dim reader As Data.SqlClient.SqlDataReader

reader = sqlCommand.ExecuteReader

GridView1.DataSource = reader

GridView1.DataBind()
con.Close()
End If

My question is how do i tell if a cell in a certain column is blank? The colums are defined by me in the source ie:

<asp:GridView ID="GridView1" runat="server" Height="120px" HorizontalAlign="Center" Width="800px" Font-Names="Book Antiqua" Font-Size="Small" PageSize="5000" AutoGenerateColumns="False">
<RowStyle HorizontalAlign="Center" VerticalAlign="Middle" BackColor="White" />
<HeaderStyle BackColor="Silver" HorizontalAlign="Center" VerticalAlign="Middle"/>
<Columns>
<asp:CommandField HeaderText="Update" ShowSelectButton="True" SelectText="SELECT">
<ControlStyle Font-Names="Book Antiqua" Font-Size="Small" Font-Underline="False"
ForeColor="Black" />
</asp:CommandField>

<asp:BoundField DataField="System" HeaderText="System" />
<asp:BoundField DataField="clientcode" HeaderText="Client Code" />
<asp:BoundField DataField="reportcode" HeaderText="Report Code" />
<asp:BoundField DataField="PurchaseName" HeaderText="Report Name" />
</Columns>


</asp:GridView>


I want to find out if there are any blanks in the column reportcode and then make the background for that row to be a different color. Help please!
 
Back
Top