Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Display a single quote in a GridView's ToolTip

Display a single quote in a GridView's ToolTip

Scheduled Pinned Locked Moved ASP.NET
question
11 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Dr_X

    The following code works:

    <
    <
    <ToolTip='<%# "View employee information for " & Eval("FullName") & "." %>' />
    <
    <

    As I said, all works well here. However, I would prefer to have the following display for the ToolTip instead:

    ToolTip='<%# "View " & Eval("FullName") & "' employee information." %>'

    However it does not like the single quote ('). I have tried placing 2 and 3 single quotes in a row and it still fails. Any ideas? Thanks, Michael

    I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)

    A Offline
    A Offline
    andyharman
    wrote on last edited by
    #2

    Try replacing with '

    D 1 Reply Last reply
    0
    • A andyharman

      Try replacing with '

      D Offline
      D Offline
      Dr_X
      wrote on last edited by
      #3

      Thanks for the reply however it literally show up the "'". I even tried the following:

      ToolTip='<%# System.Web.HttpUtility.HtmlDecode("View " & Eval("FullName") & "' employee information.") %>'

      It failed as well. Any other ideas? Michael

      I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)

      B 1 Reply Last reply
      0
      • D Dr_X

        Thanks for the reply however it literally show up the "'". I even tried the following:

        ToolTip='<%# System.Web.HttpUtility.HtmlDecode("View " & Eval("FullName") & "' employee information.") %>'

        It failed as well. Any other ideas? Michael

        I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)

        B Offline
        B Offline
        badgrs
        wrote on last edited by
        #4

        Escape it with a backslash?

        D 1 Reply Last reply
        0
        • B badgrs

          Escape it with a backslash?

          D Offline
          D Offline
          Dr_X
          wrote on last edited by
          #5

          Thanks but I have already tried that as well. I get the usual 'server tag not well formed' error and the page does not render. Michael

          I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)

          1 Reply Last reply
          0
          • D Dr_X

            The following code works:

            <
            <
            <ToolTip='<%# "View employee information for " & Eval("FullName") & "." %>' />
            <
            <

            As I said, all works well here. However, I would prefer to have the following display for the ToolTip instead:

            ToolTip='<%# "View " & Eval("FullName") & "' employee information." %>'

            However it does not like the single quote ('). I have tried placing 2 and 3 single quotes in a row and it still fails. Any ideas? Thanks, Michael

            I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)

            D Offline
            D Offline
            DavidNohejl
            wrote on last edited by
            #6

            Try ToolTip='<%# MyCodebehindFormatingMethod(Eval("FullName")) %>'


            "Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus

            1 Reply Last reply
            0
            • D Dr_X

              The following code works:

              <
              <
              <ToolTip='<%# "View employee information for " & Eval("FullName") & "." %>' />
              <
              <

              As I said, all works well here. However, I would prefer to have the following display for the ToolTip instead:

              ToolTip='<%# "View " & Eval("FullName") & "' employee information." %>'

              However it does not like the single quote ('). I have tried placing 2 and 3 single quotes in a row and it still fails. Any ideas? Thanks, Michael

              I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)

              D Offline
              D Offline
              Dr_X
              wrote on last edited by
              #7

              I'd rather not use a code-behind function. Here's the work-around I came up with:

              ToolTip='<%# "View " & Eval("FullName") & chr(39) & "s employee information." %>'

              It doesn't seem to mind the chr(39) with in the html. If anyone comes up with a better one, feel free to post... Michael

              I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)

              B 1 Reply Last reply
              0
              • D Dr_X

                I'd rather not use a code-behind function. Here's the work-around I came up with:

                ToolTip='<%# "View " & Eval("FullName") & chr(39) & "s employee information." %>'

                It doesn't seem to mind the chr(39) with in the html. If anyone comes up with a better one, feel free to post... Michael

                I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)

                B Offline
                B Offline
                badgrs
                wrote on last edited by
                #8

                Have you tried string.Format()? I think the Eval function can also be used in the way directly.

                D 1 Reply Last reply
                0
                • B badgrs

                  Have you tried string.Format()? I think the Eval function can also be used in the way directly.

                  D Offline
                  D Offline
                  Dr_X
                  wrote on last edited by
                  #9

                  It liked this:

                  ToolTip='<%# String.Format("View " & Eval("FullName") & "{0}s employee information.", chr(39)) %>'

                  but not this

                  ToolTip='<%# String.Format("View " & Eval("FullName") & "{0}s employee information.", "'") %>'

                  For some reason it really jsut does not like the single quote. Michael

                  I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)

                  A 1 Reply Last reply
                  0
                  • D Dr_X

                    It liked this:

                    ToolTip='<%# String.Format("View " & Eval("FullName") & "{0}s employee information.", chr(39)) %>'

                    but not this

                    ToolTip='<%# String.Format("View " & Eval("FullName") & "{0}s employee information.", "'") %>'

                    For some reason it really jsut does not like the single quote. Michael

                    I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)

                    A Offline
                    A Offline
                    andyharman
                    wrote on last edited by
                    #10

                    Cracked it! Use &#39;. I test it using:

                    <html>
                    <body>
                    <span title='Andy&#39;s tooltip'>hello world</span>
                    </body>
                    </html>
                    

                    Regards Andy

                    D 1 Reply Last reply
                    0
                    • A andyharman

                      Cracked it! Use &#39;. I test it using:

                      <html>
                      <body>
                      <span title='Andy&#39;s tooltip'>hello world</span>
                      </body>
                      </html>
                      

                      Regards Andy

                      D Offline
                      D Offline
                      Dr_X
                      wrote on last edited by
                      #11

                      Hey that did work and is the best solution. Thanks! Do you have any ideas on this recent post? NavigateUrl='<%=CodeBehindFunction %>' does not work[^] Thanks, Michael

                      I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups