I ended up solving the problem as follows:
<ItemTemplate>
<b><%#Container.DataItem("TitleText")%></b><%#IsBlankOrNull(Container.DataItem("TitleText") ,
"", "<br />")%>
<%#Container.DataItem("ParagraphText")%>
<br /><br />
</ItemTemplate>
and then the following in my base class:
Public Function IsBlankOrNull(ByVal blnValue As Object, ByVal
objValueIfTrue As String, ByVal objValueIfFalse As String) As String
If blnValue Is DBNull.Value Then
Return objValueIfFalse
ElseIf CType(blnValue, String) = Nothing Then
Return objValueIfFalse
Else
If CType(blnValue, String) = "" Then
Return objValueIfFalse
Else
Return objValueIfTrue
End If
End If
End Function
Karl Seguin wrote:
There are a number of ways, the cleanest and one that'll scale the best is
to hook into the ItemDataBound event of your repeater and control the output
programatically.
For example, you could do:
<asp:literal id="Extra" runat="server"><br /><br /></asp:Literal>
and in the ItemDataBound do:
if (records are null)
{
((Literal)e.Item.FindControl("Extra")).Visible = false;
}
You can read up more at:
http://openmymind.net/index.aspx?documentId=8#4.2
Karl
--
http://www.openmymind.net/
http://www.fuelindustries.com/
"HockeyFan" <le**********@gmail.comwrote in message
news:11*********************@j72g2000cwa.googlegro ups.com...
I have the following inside a repeater:
<ItemTemplate>
<b><%#Container.DataItem("TitleText")%></b><br />
<%#Container.DataItem("ParagraphText")%>
<br /><br />
</ItemTemplate>
if for some reason, the TitleText is blank or null I'd like to not have
the <br/tag. In other words, I only want the <br/tag if TitleText
has something in it.
Can I do this, and if so, how best to accomplish?