Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > problem with tags

Reply
Thread Tools

problem with tags

 
 
miladhatam@gmail.com
Guest
Posts: n/a
 
      01-15-2008
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 ...
 
Reply With Quote
 
 
 
 
Jonathan Wood
Guest
Posts: n/a
 
      01-15-2008
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

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 ...


 
Reply With Quote
 
 
 
 
Milosz Skalecki [MCAD]
Guest
Posts: n/a
 
      01-15-2008
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
>
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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 ...

>
>

 
Reply With Quote
 
Jonathan Wood
Guest
Posts: n/a
 
      01-15-2008
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]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>>
>> <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > 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 ...

>>
>>


 
Reply With Quote
 
miladhatam@gmail.com
Guest
Posts: n/a
 
      01-16-2008

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

 
Reply With Quote
 
marss
Guest
Posts: n/a
 
      01-16-2008
On 16 Січ, 07:15, "(E-Mail Removed)" <(E-Mail Removed)> 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

 
Reply With Quote
 
miladhatam@gmail.com
Guest
Posts: n/a
 
      01-16-2008
oh thanks
i do this and work well
thanks my friend
 
Reply With Quote
 
Milosz Skalecki [MCAD]
Guest
Posts: n/a
 
      01-16-2008
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, "(E-Mail Removed)" <(E-Mail Removed)> 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
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
All style tags after the first 30 style tags on an HTML page are not applied in Internet Explorer Rob Nicholson ASP .Net 3 05-28-2005 03:11 PM
Evaluating struts tags inside my own custom tags... A. Brinkmann Java 2 04-16-2004 07:44 AM
JSP newbie - use include, custom tags, standard tags - or what? Mike Java 3 01-09-2004 09:30 AM
RegEx to find CFML tags nested in HTML tags Dean H. Saxe Perl 0 01-03-2004 06:11 PM
Custom Tags within Custom Tags. Ranganath Java 2 10-21-2003 06:14 AM



Advertisments