Passing embedded string to Response.Write

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tim8w
    New Member
    • May 2008
    • 3

    Passing embedded string to Response.Write

    I need to pass the following to Response.Write:

    style="display: none;"

    Can't get it to accept this correctly...
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Please post the code, difficult to say what you did wrong without seeing what you tried.

    Comment

    • tim8w
      New Member
      • May 2008
      • 3

      #3
      Rabbit,

      Was trying to do something like this:

      Code:
      <tr <%If ((rsScheduleItem.Fields.Item("FormatID").Value) = 36) Then Response.Write("style=display:inline;") : Response.Write("style=display:none;")%>>
      But I couldn't get it to work...

      I ended up doing this instead:

      Code:
      <%If ((rsScheduleItem.Fields.Item("FormatID").Value) =  36) Then %>
      <tr> 
      </tr>
      <% End If %>
      Last edited by Rabbit; Feb 26 '16, 10:39 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Please use code tags when posting code or formatted data.

        Your code block doesn't have those double quotes that you have in your first post.

        Comment

        • tim8w
          New Member
          • May 2008
          • 3

          #5
          Rabbit,
          That's because what's in the first post is what I was trying to put in the Response.Write, but It won't take it that way. What I showed in the second post was an attempt to get it to work. I also tried it with double-quotes and triple quotes. None worked...

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            If you're going to put double quotes inside double quotes, you need to escape them, otherwise it has no idea you want it as part of a string rather than ending or starting a string.

            Comment

            • mothman
              New Member
              • Apr 2026
              • 2

              #7
              Response Write in ASP NET is used to display text directly on a web page. When the text includes embedded quotes, they must be handled carefully to avoid errors.

              This can be done by using single quotes inside the text, escaping double quotes, or using a verbatim string format. It is also important to encode any user input to prevent security issues like cross site scripting.
              سوق العمل
              In general it is useful for simple output, but in modern applications it is better to use structured approaches like Razor views.
              zz0.a40lqycs3m4 zz

              Comment

              Working...