Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Repeater Control - Test for Null or Empty Field


Message #1 by "Mitchell Adams" <MADAMS@p...> on Mon, 28 Oct 2002 09:28:53 -0500
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=3D"List" runat=3D"server">

<ItemTemplate>

<a href=3D"http://<%# Container.DataItem("URL") %>" target=3D"_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




  Return to Index