Results 1 to 7 of 7

Thread: ASP and/or HTML Table Question **Resolved**

  1. #1

    Thread Starter
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    ASP and/or HTML Table Question **Resolved**

    I just started playing around with ASP and I am able to display data from a MS SQL db. One question I have that some of the rows from my query have fields that have either null or "" values. When these rows are displayed in the table the borders for those fields are not printed. I have tried appending and empty string to each field but to no avail.

    Here is my Code:

    VB Code:
    1. Do While Not rstSimple.EOF
    2.     %>
    3.     <tr>
    4.         <td><%= rstSimple.Fields("Incident_Type").Value%></td>
    5.         <td><%= rstSimple.Fields("Filenum").Value%></td>
    6.         <td><%= rstSimple.Fields("CASENUM").Value%></td>
    7.         <td><%= rstSimple.Fields("STATUS").Value%></td>
    8.     </tr>
    9.     <%
    10.     rstSimple.MoveNext
    11. Loop
    Last edited by Mark Gambo; Aug 16th, 2004 at 12:18 PM.
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Check for a null value, and if it's null, print an &nbsp; instead.

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    &nbsp;

    ^--- that. Didn't show up in the first post.

  4. #4

    Thread Starter
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    One more question....

    Thanks, that did the trick. I just added it after each field:
    VB Code:
    1. <TD><%=rstSimple.Fields("Incident_Type").Value%> %nbsp</TD>
    Are there any problems with the above code?

    Can I use the IIF() command to check for a null value?

    Thanks,

    (Sent from my Treo 600)
    Last edited by Mark Gambo; Aug 16th, 2004 at 08:40 AM.
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  5. #5
    Fanatic Member davebat's Avatar
    Join Date
    Dec 2002
    Posts
    727
    use

    VB Code:
    1. <%
    2. if trim(rstSimple.Fields("Incident_Type").Value) = "" then
    3.   response.write "&nbsp;"
    4. else
    5.   response.write rstSimple.Fields("Incident_Type").Value
    6. end if
    7. %>

  6. #6

    Thread Starter
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Hyperlinks and Fields

    mendhak and DaveBat,

    Thank you very much. Your posts were right on the money.


    One last question and I promise this is it. In the table I am displaying Serial Numbers, and I want the user to be able to click on the serial number (Hyperlink) and then load another page. I tried this:

    VB Code:
    1. <TD><%=rstSimple.Fields("Incident_Type").Value%> %nbsp <A HREF =rstSimple.Fields("Incident_Type").Value </a></TD>

    But I am getting an error. Any suggestions?
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  7. #7

    Thread Starter
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    I figured it out!!

    I figure it out:

    VB Code:
    1. <TD><A HREF="NotInstalled.HTM"><%=rstSimple.Fields("Incident_Type").Value%></A></TD>

    Thanks Again!!!
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width