I have something here that can serve as an example for you.
[calendar.aspx]
<asp:datalist id="Datalist1" runat="server" Width="100%" BorderWidth="1px"
CellPadding="3" BorderColor="#E7E7FF" cellSpacing="2">
<ItemTemplate>
<tr>
<td width="150" bgcolor="#c0c0c0">
<%# DataBinder.Eval
(Container.DataItem, "Title") %>
</td>
<td width="90" bgcolor="#c0c0c0" nowrap="true">
<%# DisplayType(DataBinder.Eval
(Container.DataItem, "Type")) %>
</td>
<td width="250" bgcolor="#c0c0c0">
<%# DataBinder.Eval
(Container.DataItem, "Reminder") %>
</td>
</tr>
</ItemTemplate>
</asp:datalist>
[calendar.aspx.vb]
Function DisplayType(ByVal Type As Integer) As String
Select Case Type
Case 1
Return "General"
Case 2
Return "Appointment"
Case 3
Return "Birthday"
Case 4
Return "Holiday"
Case 5
Return "Romance"
Case 6
Return "Festival"
Case 7
Return "Indoor Activity"
Case 8
Return "Outdoor Activity"
Case 9
Return "Special Occasion"
Case 10
Return "Project Work"
Case 11
Return "Auction"
Case 12
Return "Retail"
Case Else
Return ""
End Select
End Function
The function can have more than 1 parameter and is returning a string that
can consist of anything (i.e. the function parameters).
Previous message:
> I have the following Repeater control. How can I test for null or an
empty field and then not write that field to the browser.
The following works for null but not for empty. Should I create a
function which will test each field?
<asp:Repeater id="List" runat=3D"server">
<ItemTemplate>
<a href="http://<%# Container.DataItem("URL") %>" target="_blank" >
<%# Container.DataItem("CompanyName") %>
</a>
<%# DataBinder.Eval(Container.DataItem,"Address1", "<br>{0}") %>
<%# DataBinder.Eval(Container.DataItem,"Address2", "<br>{0}") %>
<%# DataBinder.Eval(Container.DataItem,"Phone_AreaCode", "{0}") %>
<%# DataBinder.Eval(Container.DataItem,"Phone", "{0}") %>
</ItemTemplate>
</asp:Repeater>
I need to do something like this:
If objRS("Phone2_AC") <> "" Then Response.Write "(" & objRS("Phone2_AC") &
") "
If objRS("Phone2") <> "" Then Response.Write objRS("Phone2") & "<br>"
Thanks
Mitch