Hi Miguel,
Don't forget that you can use an IIF inside a template item. In the
following code, the IIF checks the value of the "Boolean" field and returns
the English or French button depending on whether the value is true or
false. You could probably adapt this technique to your Yes and No image
locations.
Does this help?
Ken
Microsoft MVP [ASP.NET]
<asp:DataGrid id="DataGrid1" runat="server">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Image id="Image1" runat="server"
ImageUrl='<%# IIf(DataBinder.Eval(Container,
"DataItem.Boolean"),"http://www.gc.ca/images/englishbt.gif","http://www.gc.ca/images/francaisbt.gif")
%>'>
</asp:Image>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
If Not IsPostBack Then
DataGrid1.DataSource = CreateDataSource()
DataGrid1.DataBind()
End If
End Sub
Function CreateDataSource() As ICollection
Dim dt As New DataTable
Dim dr As DataRow
dt.Columns.Add(New DataColumn _
("IntegerValue", GetType(Int32)))
dt.Columns.Add(New DataColumn _
("StringValue", GetType(String)))
dt.Columns.Add(New DataColumn _
("PercentValue", GetType(Double)))
dt.Columns.Add _
(New DataColumn("Boolean", GetType(Boolean)))
Dim i As Integer
For i = 0 To 8
dr = dt.NewRow()
dr(0) = i
dr(1) = "Item " + i.ToString()
dr(2) = 0.23 * (i + 1)
If i = 5 Then
dr(3) = False
Else
dr(3) = True
End If
dt.Rows.Add(dr)
Next i
Dim dv As New DataView(dt)
Return dv
End Function 'CreateDataSource
"Miguel Dias Moura" <we****@27NOSPAMlamps.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hello,
i know how to hide a table according to a condition:
<table runat="server" visible='<%# dataSetBibliotecas.FieldValue("Titulo",
Container) <> "" %>'...
Now I am trying to change the image file as follows:
- Show the image "yes.gif" if the value of a dynamic field is equal to
"YES";
- Show the image "no.gif" if the value of a dynamic field is equal to
"NO".
Do you think this is possible? Can you help me out?
Thank You,
Miguel