problem with tags

problem with tags

am 15.01.2008 21:07:55 von miladhatam

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 ...

Re: problem with tags

am 15.01.2008 22:22:21 von Jonathan Wood

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:d609e7fb-4088-4381-a255-950d0c27e66f@x69g2000hsx.google groups.com...
> 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 ...

Re: problem with tags

am 16.01.2008 00:12:01 von mily242

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:d609e7fb-4088-4381-a255-950d0c27e66f@x69g2000hsx.google groups.com...
> > 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 ...
>
>

Re: problem with tags

am 16.01.2008 00:25:24 von Jonathan Wood

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:598C001D-9859-45E5-85B2-86869A1A8331@microsoft.com...
> 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:d609e7fb-4088-4381-a255-950d0c27e66f@x69g2000hsx.google groups.com...
>> > 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 ...
>>
>>

Re: problem with tags

am 16.01.2008 06:15:55 von miladhatam

:)
sorry my english language is not good
for eg :
in my record of field is this text
hello world
and i want to show only 5 first chars
i don't want the "" tag be
i need my basic text without any style
that is the "hello"
thanks for your attention

Re: problem with tags

am 16.01.2008 06:51:50 von marss

On 16 Січ, 07:15, "miladha...@gmail.com" m> wrote:

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

Remove tag by means of a regular expression.

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

And then pureText.SubString(..

Regards
Mykola
http://marss.co.ua - Casual ideas for web development

Re: problem with tags

am 16.01.2008 13:29:18 von miladhatam

oh thanks
i do this and work well
thanks my friend

Re: problem with tags

am 17.01.2008 00:06:00 von mily242

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, "miladha...@gmail.com" wrote:
>
> > in my record of field is this text
> > hello world
> > and i want to show only 5 first chars
> > i don't want the "" 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
>
>