Hi All.

I am developing a website in asp.net 3.5.

I am trying to retrieve records from a database and display. Before each record I want to dispaly the title of the record such as: "Department Accounts" where the word accounts is from the database.

However, if a record is null such as no mobile telephone number my page is displaying the word "Mobile" but as the record is null there is no record to show. This is no good.

I want to test if the record is null and if it is display nothing. If it is display the record along with the title.

<asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1">
                <asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder>
            <div style="width:100%; height:auto; padding:10px; background-color:#efefef; clear:both; float:left; border:1px solid #c5c5c5; margin:5px;">        
            <%#Eval("staff_name")%> <br />
            Department: <%#Eval("department")%> <br />
            Title: <%#Eval("job_title")%> <br />
            Telephone: <%#Eval("telephone")%> <br />

Somthing like this:

If Database Record(Mobile) is null
Display ""
Display "<p>Mobile Number" + Record(Mobile)</p>

Any help is greatly appreciated!

Thanks, Paul

7 Years
Discussion Span
Last Post by khadakbist
isnull(mobile,'No record')

from table

Edited by peter_budo: Keep It Clear - Do wrap your programming code blocks within [code] ... [/code] tags

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.