Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

HTML / ASP Extra BR tags being created

Options
  • 31-10-2006 11:37am
    #1
    Registered Users Posts: 2,278 ✭✭✭


    Am working on a page for a friend - and running into an odd problem I haven't encountered before.

    I have a page that is retrieving records from an Access database, based on a car type. So for Audi - 7 records come back, BMW - 4 records come back, and Landrover - 1 record. I loop through each record, and create a cell in a table, with a maximum of 3 before I start a new row.

    That bit seems to work fine. However, the table I'm creating is nested in another table - this is hardcoded in HTML and not dynamic in any way. Immediately before my dynamic table is created in ASP (with the records I'm retrieving from the database) <BR> tags are somehow being created - two of them for Audi, one for BMW and none for Landrover - which is resulting in my table shifting down depending on record type, and hence looking crap.

    I'm not creating these tags anywhere in code, they're just appearing on their own it seems! Any ideas?


Comments

  • Registered Users Posts: 273 ✭✭stipey


    is it definitely a <br> tag being inserted - it could be something in the styling of the outer table.

    Also are you using a normal text editor or a WYSIWYG job?


  • Registered Users Posts: 2,278 ✭✭✭kdevitt


    Using notepad to edit it at this stage as I don't want any grief from Frontpage. Its definitely adding <BR> tags - have saved the source of the page with each different car type, and there are the extra tags each time.


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    If the <br> tags are _definitely_ there, then they must be added where the car is being entered into the database?

    What happens if you run the query in Access itself - are the <br> tags there as well?

    A quick fix may just be to replace the <br> tags with nothing.
    <%
    sCarName = objRS("carname")
    sCarName = Replace(lcase(sCarName), "<br>", "")
    %>
    


  • Registered Users Posts: 2,278 ✭✭✭kdevitt


    eoin_s wrote:
    If the <br> tags are _definitely_ there, then they must be added where the car is being entered into the database?

    What happens if you run the query in Access itself - are the <br> tags there as well?

    A quick fix may just be to replace the <br> tags with nothing.
    <%
    sCarName = objRS("carname")
    sCarName = Replace(lcase(sCarName), "<br>", "")
    %>
    

    Thats the thing - theres no BR tags at all in the database. Its just a standard select from a table, numeric field and a text field - which I've re-entered a few times to ensure no html tags were in.

    The BR tags are being inserted into what is static HTML code. Theres no ASP code until further down the page??


  • Moderators, Politics Moderators Posts: 39,812 Mod ✭✭✭✭Seth Brundle


    Ken - if you want, email me your code and I'll have a look at it.


  • Advertisement
  • Registered Users Posts: 2,278 ✭✭✭kdevitt


    Will do - its on my laptop, so will send it on when I get home. Cheers.


  • Registered Users Posts: 2,781 ✭✭✭amen


    how are you inserted the <br> tags for the Audi/BMW etc
    are they inside the for loop as you loop through the vehicle i.e
    <%for i=1 to VehicleCount%>
    <br><%=VehicleType%></br>
    <%next%>

    or are you using Reponse.Write
    can you post some code


  • Registered Users Posts: 2,278 ✭✭✭kdevitt


    Heres a very chopped down section of the code, i.e not as it is currently, just to show where the problem is coming in because I'm not sure I'm making sense.

    <a href="wheels.asp?cid=1">Audi / VW</a>  :: 
    <a href="wheels.asp?cid=2">BMW</a>  :: 
    <a href="wheels.asp?cid=3">Land Rover</a>  :: 
    <a href="wheels.asp?cid=4">Mercedes</a></font></td>
    <td valign="top" rowspan="2" height="100%">
    <table bgcolor="#353a42" border="0" cellpadding="0" cellspacing="0" width="205">
    <tr>

    <%
    i=0
    Do While MyRS.eof = false
    %>
    <td align="left" width="128" style="padding: 0" valign="top">
    <a target="wheelviewer" href="WheelSelector.asp?ID=<%=MyRS("ID")%>">
    <img src="Images/Thumbs/<%=MyRS("Imagename")%>" border="0"></a><strong><br>
    <span class="headline"> <%=myrs("WheelName")%></span></strong><br>
    <span class="editor"> Size(s) : <%=Myrs("Sizes")%></span></td>
    <%
    Myrs.movenext etc
    %>

    The extra <BR> tags were coming in immediately after the "<table bgcolor="#353a42" border="0" cellpadding="0" cellspacing="0" width="205">" line. Which doesn't make any sense at all to me as its outside of any ASP code.


  • Registered Users Posts: 2,781 ✭✭✭amen


    hmm
    i think your problem is that in your loop code. Are some of fields are coming back blank? Can you post the full code?

    Is this production or project code?
    you have somewhat strange way of opening/closing your html tags and laying out your table.
    you should have a look at TH rows


Advertisement