Quote Trouble

Discussion in 'ASP General' started by scott, Aug 3, 2005.

  1. scott

    scott Guest

    I have a style variable below that I can't figure correct quotes for in
    response.write line. Any help?


    CODE:

    sTeamVisible = "visibility: visible;"


    Response.Write "<td class=""teamdrop1"" style=""" & sTeamVisible & """ & " "
    & RenderTeamFilter(teamID) & "</td>" & vbCrLf
     
    scott, Aug 3, 2005
    #1
    1. Advertising

  2. scott

    scott Guest

    thanks for opening my eyes, i forgot about the single quotes with styles.


    "Bob Lehmann" <> wrote in message
    news:%...
    > Response.Write "<td class='teamdrop1' style='" & sTeamVisible & "'" & " "
    > &
    > RenderTeamFilter(teamID) & "</td>" & vbCrLf
    >
    > Bob Lehmann
    >
    > "scott" <> wrote in message
    > news:%...
    >> I have a style variable below that I can't figure correct quotes for in
    >> response.write line. Any help?
    >>
    >>
    >> CODE:
    >>
    >> sTeamVisible = "visibility: visible;"
    >>
    >>
    >> Response.Write "<td class=""teamdrop1"" style=""" & sTeamVisible & """ &
    >> "

    > "
    >> & RenderTeamFilter(teamID) & "</td>" & vbCrLf
    >>
    >>

    >
    >
     
    scott, Aug 4, 2005
    #2
    1. Advertising

  3. scott

    Bob Lehmann Guest

    Response.Write "<td class='teamdrop1' style='" & sTeamVisible & "'" & " " &
    RenderTeamFilter(teamID) & "</td>" & vbCrLf

    Bob Lehmann

    "scott" <> wrote in message
    news:%...
    > I have a style variable below that I can't figure correct quotes for in
    > response.write line. Any help?
    >
    >
    > CODE:
    >
    > sTeamVisible = "visibility: visible;"
    >
    >
    > Response.Write "<td class=""teamdrop1"" style=""" & sTeamVisible & """ & "

    "
    > & RenderTeamFilter(teamID) & "</td>" & vbCrLf
    >
    >
     
    Bob Lehmann, Aug 4, 2005
    #3
  4. Are you getting an error? If not, what tells you it's not right? What does
    a view-source give you? What does RenderTeamFilter return?

    Ray at home

    "scott" <> wrote in message
    news:%...
    >I have a style variable below that I can't figure correct quotes for in
    >response.write line. Any help?
    >
    >
    > CODE:
    >
    > sTeamVisible = "visibility: visible;"
    >
    >
    > Response.Write "<td class=""teamdrop1"" style=""" & sTeamVisible & """ & "
    > " & RenderTeamFilter(teamID) & "</td>" & vbCrLf
    >
    >
     
    Ray Costanzo [MVP], Aug 4, 2005
    #4
  5. >I have a style variable below that I can't figure correct quotes for in
    >response.write line. Any help?


    Response.Write "<td class=tempdrop1 style='" & sTeamVisible & "'>"
    Response.Write RenderTeamFilter(TeamID)
    Response.Write "</td>" & vbCrLf

    I find it easier to read and manage quotes if I omit them when not necessary
    (e.g. around a word like "teamdrop1"). No, this isn't explicitly correct,
    but it sure is useful during debugging, especially when working in an editor
    that doesn't make a clear distinction between two ' and one " ...

    I also find it easier to manage stuff like this if I break separate elements
    onto their own line. Your main problem here, I think, is that you forgot to
    close the opening <td> tag. So the resulting output (which you would have
    been able to discover if you viewed source) was something like:

    <td class="teampdrop1" style="visibility: visible" result of
    renderTeamFilter(TeamID)</td>

    I find little value in adding all these vbCrLf to the output HTML, unless
    you really have a need for the output to be tidy (such as debugging complex
    and dynamic HTML layout).

    Finally, since the default visibility *is* visible, there is no reason to
    explicitly declare this style (you could make it an attribute of tempdrop1
    class if you really wanted to), the only time you would need to override the
    default and explicitly declare a style attribute is if you were setting it
    to something *other* than visible. So your ASP code could just as easily
    look like this, and the result in terms of appearance and functionality will
    be exactly the same:

    <%
    ....
    Response.Write "<td class=tempdrop1>"
    Response.Write RenderTeamFilter(TeamID)
    Response.Write "</td>"
    ....
    %>

    or:

    <%
    ....
    Response.Write "<td class=tempdrop1>" & RenderTeamFilter(TeamID) & "</td>"
    ....
    %>

    or:

    <%
    ....
    Response.Write "<td class=tempdrop1>" & _
    RenderTeamFilter(TeamID) & "</td>"
    ....
    %>

    or:

    <td class=tempdrop1><%=RenderTeamFilter(TeamID)%></td>

    There are many ways to skin a cat. Some are a little more likely than
    others to yield scratches, cuts & bruises.
     
    Aaron Bertrand [SQL Server MVP], Aug 4, 2005
    #5
  6. scott

    scott Guest

    i was until bob helped. ie was giving error about quotes.


    "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
    message news:...
    > Are you getting an error? If not, what tells you it's not right? What
    > does a view-source give you? What does RenderTeamFilter return?
    >
    > Ray at home
    >
    > "scott" <> wrote in message
    > news:%...
    >>I have a style variable below that I can't figure correct quotes for in
    >>response.write line. Any help?
    >>
    >>
    >> CODE:
    >>
    >> sTeamVisible = "visibility: visible;"
    >>
    >>
    >> Response.Write "<td class=""teamdrop1"" style=""" & sTeamVisible & """ &
    >> " " & RenderTeamFilter(teamID) & "</td>" & vbCrLf
    >>
    >>

    >
    >
     
    scott, Aug 4, 2005
    #6
  7. scott

    scott Guest

    thanks for the tips, you're right about keeping it simple.

    my reason for the visible variable is i'm hiding/showing that cell.

    thanks for your help and extra explanation.

    "Aaron Bertrand [SQL Server MVP]" <> wrote in message
    news:...
    > >I have a style variable below that I can't figure correct quotes for in
    > >response.write line. Any help?

    >
    > Response.Write "<td class=tempdrop1 style='" & sTeamVisible & "'>"
    > Response.Write RenderTeamFilter(TeamID)
    > Response.Write "</td>" & vbCrLf
    >
    > I find it easier to read and manage quotes if I omit them when not
    > necessary (e.g. around a word like "teamdrop1"). No, this isn't
    > explicitly correct, but it sure is useful during debugging, especially
    > when working in an editor that doesn't make a clear distinction between
    > two ' and one " ...
    >
    > I also find it easier to manage stuff like this if I break separate
    > elements onto their own line. Your main problem here, I think, is that
    > you forgot to close the opening <td> tag. So the resulting output (which
    > you would have been able to discover if you viewed source) was something
    > like:
    >
    > <td class="teampdrop1" style="visibility: visible" result of
    > renderTeamFilter(TeamID)</td>
    >
    > I find little value in adding all these vbCrLf to the output HTML, unless
    > you really have a need for the output to be tidy (such as debugging
    > complex and dynamic HTML layout).
    >
    > Finally, since the default visibility *is* visible, there is no reason to
    > explicitly declare this style (you could make it an attribute of tempdrop1
    > class if you really wanted to), the only time you would need to override
    > the default and explicitly declare a style attribute is if you were
    > setting it to something *other* than visible. So your ASP code could just
    > as easily look like this, and the result in terms of appearance and
    > functionality will be exactly the same:
    >
    > <%
    > ...
    > Response.Write "<td class=tempdrop1>"
    > Response.Write RenderTeamFilter(TeamID)
    > Response.Write "</td>"
    > ...
    > %>
    >
    > or:
    >
    > <%
    > ...
    > Response.Write "<td class=tempdrop1>" & RenderTeamFilter(TeamID) & "</td>"
    > ...
    > %>
    >
    > or:
    >
    > <%
    > ...
    > Response.Write "<td class=tempdrop1>" & _
    > RenderTeamFilter(TeamID) & "</td>"
    > ...
    > %>
    >
    > or:
    >
    > <td class=tempdrop1><%=RenderTeamFilter(TeamID)%></td>
    >
    > There are many ways to skin a cat. Some are a little more likely than
    > others to yield scratches, cuts & bruises.
    >
     
    scott, Aug 4, 2005
    #7
  8. scott

    CJM Guest

    "Aaron Bertrand [SQL Server MVP]" <> wrote in message
    news:...
    >
    > I find it easier to read and manage quotes if I omit them when not
    > necessary (e.g. around a word like "teamdrop1"). No, this isn't
    > explicitly correct, but it sure is useful during debugging, ....


    It's is either explicitly correct or incorrect depending on what DOCTYPE you
    are validating against.

    For HTML4.01 and earlier, quotes are optional (though I prefer them).

    For XHTML, they are mandatory for validation.

    But, hell...who validates in this group?

    >
    > There are many ways to skin a cat. Some are a little more likely than
    > others to yield scratches, cuts & bruises.


    With your permission, I think I might borrow this line.

    Chris
     
    CJM, Aug 4, 2005
    #8
  9. > my reason for the visible variable is i'm hiding/showing that cell.

    You can still do that without explicitly starting it off as visible (since
    it does that by default anyway). But unless you are affecting the whole
    class en masse in client-side script, the element will need an id to
    reference.

    A
     
    Aaron Bertrand [SQL Server MVP], Aug 4, 2005
    #9
  10. > It's is either explicitly correct or incorrect depending on what DOCTYPE
    > you are validating against.


    If you are validating at all. :)

    > With your permission, I think I might borrow this line.


    By all means.
     
    Aaron Bertrand [SQL Server MVP], Aug 4, 2005
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    13,325
  2. Stimp
    Replies:
    2
    Views:
    2,292
    Stimp
    Sep 20, 2006
  3. Eric Layman
    Replies:
    3
    Views:
    644
    Rad [Visual C# MVP]
    Apr 14, 2007
  4. Replies:
    6
    Views:
    447
    Stefan Ram
    Jun 15, 2008
  5. Valery Khamenya
    Replies:
    3
    Views:
    728
Loading...

Share This Page