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. Text wraping and Html tags

Text wraping and Html tags

Scheduled Pinned Locked Moved ASP.NET
csharpquestionphphtmlasp-net
3 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.
  • M Offline
    M Offline
    Marix
    wrote on last edited by
    #1

    is there a built in way (in asp.net - c#) I can strip html tags from input string (validate), some function or built in class that provides such a functionality? Is there similar function in c# similar to php function StripHTMLTags()? And second question is there a function that wraps text, if it is longer then certain count of characters? I know there is built in requestValidate property of tag, but I want to make custom validation! Thanx a lot

    P 1 Reply Last reply
    0
    • M Marix

      is there a built in way (in asp.net - c#) I can strip html tags from input string (validate), some function or built in class that provides such a functionality? Is there similar function in c# similar to php function StripHTMLTags()? And second question is there a function that wraps text, if it is longer then certain count of characters? I know there is built in requestValidate property of tag, but I want to make custom validation! Thanx a lot

      P Offline
      P Offline
      Paul Watson
      wrote on last edited by
      #2

      > strip html tags from input strin Use RegEx. This pattern works for me <(.|\n)+?> e.g. TextBox.Text = Regex.Replace(TextBox.Text, @"<(.|\n)+?>", ""); >And second question is there a function that wraps text, if it is longer then certain count of characters? But the browser should automatically wrap text to fit in it's container. What do you mean? regards, Paul Watson Bluegrass South Africa **Brian Welsch wrote:** _"blah blah blah, maybe a potato?"_ while translating my Afrikaans. [Crikey!](http://stormfront.typepad.com/) ain't life grand? [Einstein says...](http://babyurl.com/P4hvwl)

      M 1 Reply Last reply
      0
      • P Paul Watson

        > strip html tags from input strin Use RegEx. This pattern works for me <(.|\n)+?> e.g. TextBox.Text = Regex.Replace(TextBox.Text, @"<(.|\n)+?>", ""); >And second question is there a function that wraps text, if it is longer then certain count of characters? But the browser should automatically wrap text to fit in it's container. What do you mean? regards, Paul Watson Bluegrass South Africa **Brian Welsch wrote:** _"blah blah blah, maybe a potato?"_ while translating my Afrikaans. [Crikey!](http://stormfront.typepad.com/) ain't life grand? [Einstein says...](http://babyurl.com/P4hvwl)

        M Offline
        M Offline
        Marix
        wrote on last edited by
        #3

        Thanx for first question. About second, I ment that if I enter long word (100 chars) I store it in db and then display it in datagrid. And datagrid does not wrap it automatically! thanx

        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