how do i display the "On Offer" indicator when the product is on offer in the database of asp.net?
<p>I need to display the "on Offer" indicator next to the product in the gridview if the product has a number "1" in the "Offered" column in the database. if it is zero, then don't display. is there some way to achieve that? thanks.</p>

<p>In my product listing page: 
Dim objCat As New Category
Dim objProduct As New Product
Dim i As Integer 
Dim boolError As Boolean = False</p>

<p>objCat.ID = CType(Request.QueryString("CatID"), Integer)  </p>

<p>' get details of the category<br>
   objCat.GetDetails()     </p>

<p>' Display the category name<br>
   lblCatName.Text = objCat.Name<br>
  lblCatName2.Text = objCat.Name    </p>

<p>' Display the category description<br>
    lblCatDesc.Text = objCat.Description  </p>

<pre><code> objCat.GetOfferedProducts()     

For i = 0 To gvProduct.Rows.Count - 1        
' Get the ProductId from the first cell        
 objProduct.ID = gvProduct.Rows(i).Cells(0).Text   

 Dim lblOffer As Label    
 lblOffer = CType(gvProduct.Rows(i).FindControl("lblOffer"), Label)   

   If objCat.Offered = "1" Then            
   lblOffer.Visible = True        
   Else            
  lblOffer.Visible = False         
   End If    
</code></pre>

<p>Next<br>
  gvProduct.DataSource = objCat.GetProducts()<br>
  gvProduct.DataBind()</p>

<p>in my category class: 
Public Sub GetOfferedProducts()</p>

<pre><code>' Define a conection to database    
' Read connection string from the web.config file.  
  Dim strConn As String    
 strConn = ConfigurationManager.ConnectionStrings("AppDb").ToString   
 Dim conn As New SqlConnection(strConn)   

' Retrieve details of a given Category ID from the database    
  Dim strSql As String     
 strSql = "SELECT * FROM CatProduct cp INNER JOIN Product p " &amp; _     
           "ON cp.ProductID=p.ProductID INNER JOIN Category c ON                       cp.CategoryID=c.CategoryID " &amp; _         
     "WHERE cp.CategoryID=@CategoryID"   
</code></pre>

<p>' Define an Command object to execute the SQL statement<br>
  Dim cmd As New SqlCommand(strSql, conn)<br>
 ' Add parameter to the SQL command    </p>

<p>cmd.Parameters.AddWithValue("@CategoryID", ID)  </p>

<p>' Define a data adapter to fetch data<br>
Dim da As New SqlDataAdapter(cmd)    </p>

<p>' Define a data set to hold the data fetched<br>
 Dim ds As New DataSet   </p>

<p>' Open database connection<br>
 conn.Open()    </p>

<p>da.Fill(ds, "CatProduct")<br>
  ' Close the database connection    </p>

<p>conn.Close()    </p>

<p>If ds.Tables("CatProduct").Rows.Count &lt;> 0 Then<br>
    Name = ds.Tables("CatProduct").Rows(0)("CatName")<br>
       Description = ds.Tables("CatProduct").Rows(0)("CatDesc")
         ImageFile = ds.Tables("CatProduct").Rows(0)("CatImage")<br>
       Offered = CType(ds.Tables("CatProduct").Rows(0)("Offered"), Integer)
     End If </p>
