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. using "&" in a Textbox

using "&" in a Textbox

Scheduled Pinned Locked Moved ASP.NET
helpdatabase
4 Posts 2 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.
  • V Offline
    V Offline
    Visionsoft
    wrote on last edited by
    #1

    Hello everyone, Have a textbox.. when you enter & and display the result.. it works fine.. but using viewstat it actually has & for it.. so when I save it in the database.. the character & is saved rather than just "&".. can't believe i searched for an hour and couldn't find help for this simple issue :s.. any help would b highly appreciated.. Thanks Ali

    M 1 Reply Last reply
    0
    • V Visionsoft

      Hello everyone, Have a textbox.. when you enter & and display the result.. it works fine.. but using viewstat it actually has & for it.. so when I save it in the database.. the character & is saved rather than just "&".. can't believe i searched for an hour and couldn't find help for this simple issue :s.. any help would b highly appreciated.. Thanks Ali

      M Offline
      M Offline
      Michael Flanakin
      wrote on last edited by
      #2

      Ok, I'm not sure I understood the problem. I'm guessing your characters were getting converted. So, you type in the ampersand character ("&") and after post-back, the value is changed to "&". Is that correct? If so, I haven't seen that happen before. I would suggest debugging/tracing the post-back to see what's going on. Are you using a regular <asp:TextBox />? Michael Flanakin Web Log

      V 1 Reply Last reply
      0
      • M Michael Flanakin

        Ok, I'm not sure I understood the problem. I'm guessing your characters were getting converted. So, you type in the ampersand character ("&") and after post-back, the value is changed to "&". Is that correct? If so, I haven't seen that happen before. I would suggest debugging/tracing the post-back to see what's going on. Are you using a regular <asp:TextBox />? Michael Flanakin Web Log

        V Offline
        V Offline
        Visionsoft
        wrote on last edited by
        #3

        Thanks for the reply Michael.. thats exactly what i was asking for.. i got the solution.. wasn't my code.. whoever wrote it.. used Server.HtmlEncode(TextBox1.Text).. thats y & was convert to amp.. anyways.. thanks again :) Ali

        M 1 Reply Last reply
        0
        • V Visionsoft

          Thanks for the reply Michael.. thats exactly what i was asking for.. i got the solution.. wasn't my code.. whoever wrote it.. used Server.HtmlEncode(TextBox1.Text).. thats y & was convert to amp.. anyways.. thanks again :) Ali

          M Offline
          M Offline
          Michael Flanakin
          wrote on last edited by
          #4

          Glad you found the problem. I thought that was a pretty odd problem. That explains it, tho. Michael Flanakin Web Log

          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