problem with tags

Discussion in 'ASP .Net' started by miladhatam@gmail.com, Jan 15, 2008.

  1. Guest

    hi friends
    i've built a page that should show first 150 chars of every of my
    topics but when i wanted to do this work with SubString() it included
    the tags of my field of my db and very bad viewing happend
    i want to retrieve rendered text without any tag ...
    please help me ...
     
    , Jan 15, 2008
    #1
    1. Advertising

  2. Sounds like there's a problem with your code, but you didn't include your
    code, or any details about what you are doing beyond using SubString() so I
    really don't see how anyone can help you.

    Perhaps you should show, or at least describe, just what you are doing.

    Beyond that, you can set a break point at look at the string being passed to
    Substring and your arguments and you should be able to see why it returns
    what it does.

    --
    Jonathan Wood
    SoftCircuits Programming
    http://www.softcircuits.com

    <> wrote in message
    news:...
    > hi friends
    > i've built a page that should show first 150 chars of every of my
    > topics but when i wanted to do this work with SubString() it included
    > the tags of my field of my db and very bad viewing happend
    > i want to retrieve rendered text without any tag ...
    > please help me ...
     
    Jonathan Wood, Jan 15, 2008
    #2
    1. Advertising

  3. Goo evening,

    I think he's trying to trim text containing HTML content (which isn't
    trivial).
    --
    Milosz


    "Jonathan Wood" wrote:

    > Sounds like there's a problem with your code, but you didn't include your
    > code, or any details about what you are doing beyond using SubString() so I
    > really don't see how anyone can help you.
    >
    > Perhaps you should show, or at least describe, just what you are doing.
    >
    > Beyond that, you can set a break point at look at the string being passed to
    > Substring and your arguments and you should be able to see why it returns
    > what it does.
    >
    > --
    > Jonathan Wood
    > SoftCircuits Programming
    > http://www.softcircuits.com
    >
    > <> wrote in message
    > news:...
    > > hi friends
    > > i've built a page that should show first 150 chars of every of my
    > > topics but when i wanted to do this work with SubString() it included
    > > the tags of my field of my db and very bad viewing happend
    > > i want to retrieve rendered text without any tag ...
    > > please help me ...

    >
    >
     
    Milosz Skalecki [MCAD], Jan 15, 2008
    #3
  4. Perhaps, that's something I've done. It's just hard to help someone when
    they don't show what they did.

    --
    Jonathan Wood
    SoftCircuits Programming
    http://www.softcircuits.com

    "Milosz Skalecki [MCAD]" <> wrote in message
    news:...
    > Goo evening,
    >
    > I think he's trying to trim text containing HTML content (which isn't
    > trivial).
    > --
    > Milosz
    >
    >
    > "Jonathan Wood" wrote:
    >
    >> Sounds like there's a problem with your code, but you didn't include your
    >> code, or any details about what you are doing beyond using SubString() so
    >> I
    >> really don't see how anyone can help you.
    >>
    >> Perhaps you should show, or at least describe, just what you are doing.
    >>
    >> Beyond that, you can set a break point at look at the string being passed
    >> to
    >> Substring and your arguments and you should be able to see why it returns
    >> what it does.
    >>
    >> --
    >> Jonathan Wood
    >> SoftCircuits Programming
    >> http://www.softcircuits.com
    >>
    >> <> wrote in message
    >> news:...
    >> > hi friends
    >> > i've built a page that should show first 150 chars of every of my
    >> > topics but when i wanted to do this work with SubString() it included
    >> > the tags of my field of my db and very bad viewing happend
    >> > i want to retrieve rendered text without any tag ...
    >> > please help me ...

    >>
    >>
     
    Jonathan Wood, Jan 15, 2008
    #4
  5. Guest

    :)
    sorry my english language is not good
    for eg :
    in my record of field is this text
    <b> hello world </b>
    and i want to show only 5 first chars
    i don't want the "<b>" tag be
    i need my basic text without any style
    that is the "hello"
    thanks for your attention
     
    , Jan 16, 2008
    #5
  6. marss Guest

    On 16 Січ, 07:15, "" <> wrote:

    > in my record of field is this text
    > <b> hello world </b>
    > and i want to show only 5 first chars
    > i don't want the "<b>" tag be
    > i need my basic text without any style
    > that is the "hello"


    Remove tag by means of a regular expression.

    Regex re = new Regex("<[^>]*>", RegexOptions.Multiline);
    string pureText = re.Replace(originalString, "");

    And then pureText.SubString(..

    Regards
    Mykola
    http://marss.co.ua - Casual ideas for web development
     
    marss, Jan 16, 2008
    #6
  7. Guest

    oh thanks
    i do this and work well
    thanks my friend
     
    , Jan 16, 2008
    #7
  8. Goo evening guys,

    Having said it's not a trivial task i meant it's not trivial when trimming
    text but persisting HTML. Mars' resolution will work only in most all of the
    cases, but not if you trim the text at a html encoded character. This case is
    easy to handle by making sure by checking if the ampersand is not included in
    last 6 characters. Similar issue to this:
    http://www.dcomments.net/ASP_.NET/message1516138.html

    Regards
    --
    Milosz


    "marss" wrote:

    > On 16 Січ, 07:15, "" <> wrote:
    >
    > > in my record of field is this text
    > > <b> hello world </b>
    > > and i want to show only 5 first chars
    > > i don't want the "<b>" tag be
    > > i need my basic text without any style
    > > that is the "hello"

    >
    > Remove tag by means of a regular expression.
    >
    > Regex re = new Regex("<[^>]*>", RegexOptions.Multiline);
    > string pureText = re.Replace(originalString, "");
    >
    > And then pureText.SubString(..
    >
    > Regards
    > Mykola
    > http://marss.co.ua - Casual ideas for web development
    >
    >
     
    Milosz Skalecki [MCAD], Jan 16, 2008
    #8
    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. Dean H. Saxe
    Replies:
    0
    Views:
    1,052
    Dean H. Saxe
    Jan 3, 2004
  2. Rob Nicholson
    Replies:
    3
    Views:
    774
    Rob Nicholson
    May 28, 2005
  3. Ranganath

    Custom Tags within Custom Tags.

    Ranganath, Oct 17, 2003, in forum: Java
    Replies:
    2
    Views:
    470
    Ranganath
    Oct 21, 2003
  4. Mike
    Replies:
    3
    Views:
    889
    Michael Borgwardt
    Jan 9, 2004
  5. A. Brinkmann
    Replies:
    2
    Views:
    1,090
    A. Brinkmann
    Apr 16, 2004
Loading...

Share This Page