Display or Hide an image in a datagrid depending on checkbox value. (1 Viewer)

KevinM

Registered User.
Local time
Today, 14:43
Joined
Jun 15, 2000
Messages
719
This used to be so easy in classic asp but can't seem to find a way to do it in a datagrid is asp.net (1.1).

In a datagrid I have a table within a template colum that shows a photo that I would like to show or hide depending on a boolean value in the recordset that the datagrid is bound.

e.g...

<columns>
<asp:TemplateColumn>
<ItemTemplate>
<table border="0" width="0">
<td rowspan="15">
<% If bolShowPic= -1 Then pic%>
<Img src="images/<%# DataBinder.Eval(Container.DataItem,"PhotoNameWeb") %> "/>
<% End If %>

</td>
...etc etc

bolShowPic is declared on the page load to return the true/false value [ShowPic] from the table but I keep getting an error 'bolShowPic not decalred'.

Sub Page_Load
...
Dim dtrMainDetails as sqlDataReader
Dim bolShowPic As Boolean
dtrMainDetails=cmdSelectMainDetails.ExecuteReader()
dtrMainDetails.Read()
bolShowPic=dtrMainDetails("ShowPic")
...
End Sub


Is there a better way of retrieving [ShowPic] value and to use it in the datagrid?

Many THanks
 

Users who are viewing this thread

Top Bottom