Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 08, 2012 08:29 AM by ayanmesut
Member
219 Points
85 Posts
Nov 08, 2012 05:48 AM|LINK
hello,
when we use WYSIWYG Editor, it is necessary to use
Request.Unvalidated("info")
When we want to show it on the page, we use
Html.Raw(row.Info)
But At this point, I want to create a substring from the info. But I cannot convert the Raw to String? What is the best way to do that?
All-Star
154955 Points
19872 Posts
Moderator
MVP
Nov 08, 2012 06:42 AM|LINK
ayanmesut But At this point, I want to create a substring from the info.
row.Info can be treated as a string, so you can use Substring on that:
@Html.Raw(row.Info.ToString().Substring(50))
The problem you might have(depending on what you are trying to achieve) is that row.Info includes HTML as part of the string. So if row.Info was this:
<p>Hello World"</p>
row.Info.ToString().Substring(5) will return "<p>He", not "Hello".
Nov 08, 2012 07:47 AM|LINK
I have the problem which you talked about
@Html.Raw(row.Info.ToString().Substring(1,20))
returns
!DOCTYPE html PUBLIC
How can I overcome this problem?
substring
Nov 08, 2012 08:29 AM|LINK
I chaged to substring(0, 20)
it worked
thanx
ayanmesut
Member
219 Points
85 Posts
Html.Raw to String?
Nov 08, 2012 05:48 AM|LINK
hello,
when we use WYSIWYG Editor, it is necessary to use
When we want to show it on the page, we use
But At this point, I want to create a substring from the info. But I cannot convert the Raw to String? What is the best way to do that?
Mikesdotnett...
All-Star
154955 Points
19872 Posts
Moderator
MVP
Re: Html.Raw to String?
Nov 08, 2012 06:42 AM|LINK
row.Info can be treated as a string, so you can use Substring on that:
The problem you might have(depending on what you are trying to achieve) is that row.Info includes HTML as part of the string. So if row.Info was this:
<p>Hello World"</p>
row.Info.ToString().Substring(5) will return "<p>He", not "Hello".
Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter
ayanmesut
Member
219 Points
85 Posts
Re: Html.Raw to String?
Nov 08, 2012 07:47 AM|LINK
I have the problem which you talked about
returns
!DOCTYPE html PUBLIC
How can I overcome this problem?
substring
ayanmesut
Member
219 Points
85 Posts
Re: Html.Raw to String?
Nov 08, 2012 08:29 AM|LINK
I chaged to substring(0, 20)
it worked
thanx