This is a migrated thread and some comments may be shown as answers.

How to Output the HTML to a String Variable

7 Answers 397 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Vuyiswa
Top achievements
Rank 2
Vuyiswa asked on 10 Mar 2010, 11:30 AM
Good Day

Am using RadControls for ASP.NET Ajax Q2 2008. My markup looks like this

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <telerik:radeditor id="RadEditor1" runat="server" skin="Sunset" EditModes="Design, Preview">
        <Content>
 </Content>
</telerik:radeditor>

and my server side where i get what has been typed by a user


String Body = RadEditor1.Content; 


and the String Body returns a String is not html.

What am i doing wrong

7 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 10 Mar 2010, 03:08 PM
Hello Vuyiswa,

I just want to make clear that the Content property of RadEditor returns a string. This string will contain all HTML tags placed in the content area of RadEditor. You can see the tags when you switch to HTML mode.

You can test the Content property in the following live demos: Save In External File and Save in Database.
If you experience any problems with them, please explain in more details what the problem is and how to reproduce it.

Best regards,
Rumen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Vuyiswa
Top achievements
Rank 2
answered on 11 Mar 2010, 03:48 PM
So this means that before i get the full html i have to save it first to a File and retrieve the contents  again ?
0
robertw102
Top achievements
Rank 1
answered on 11 Mar 2010, 10:37 PM
The Content property of the RadEditor returns the HTML content of the RadEditor as a string. So it contains all the HTML tags and text that was entered. It doesn't return an HTML file, if that's what you were asking.

I'm assuming what you were asking is that the content returned doesn't contain HTML tags, is that what you were asking? If so, was anything entered in the RadEditor that would generate an HTML tag to be created (i.e. is there bolded text) or is just plain text that was entered. If only plain text was entered then of course that is what the Content property is going to return, since no tags were needed.
0
Vuyiswa
Top achievements
Rank 2
answered on 12 Mar 2010, 07:06 AM
Good Day robertw102

robertw102 wrote:


The Content property of the RadEditor returns the HTML content of the RadEditor as a string

So if the content property returns HTML of Rad as String, that means it should have starting html tag and othere html tags, But mine after using the content property its just like a string as the property Text does.

robertw102 wrote:


It doesn't return an HTML file, if that's what you were asking.

No this came back as a Second option if Radeditor cannot out a full html that i can store in a string , then that means the alternative way to do this is to store the html as a file externally and consume the html inside that file,of which will be cumbersome. I dont want to go that Route in thought Radeditor can output the html that you can see on the html view in the RadEditor.

robertw102 wrote:
I'm assuming what you were asking is that the content returned doesn't contain HTML tags


yes that is exactly my question

robertw102
wrote:

was anything entered in the RadEditor that would generate an HTML tag to be created (i.e. is there bolded text) or is just plain text that was entered.

Honestly Speaking, i only entered plain text, but because i went to the html view, i wanted the html string displayed in that view to be in my variable. So what you mean is that the html gets generated only if i use the formatting tools in the tool bar like bold etc , then after that it will create an html for me?


Thanks




0
robertw102
Top achievements
Rank 1
answered on 12 Mar 2010, 06:48 PM
The RadEditor does not create an HTML page structure when you call the Content property. Meaning it doesn't surround the content inside of an <html>, <head> or <body> tags. I believe that's what you're asking. Only if the RadEditor was loaded with those tags, would it return them, but otherwise it doesn't return anything like that by default.

If you want to enclose the content entered inside of the tags I mentioned above, you'll need to enclose the content returned inside of them.

I hope that helps.
0
Rumen
Telerik team
answered on 15 Mar 2010, 04:26 PM
Hi guys,

RadEditor offers the ability to edit and save full HTML page. The following demos could be helpful:

http://demos.telerik.com/aspnet-ajax/editor/examples/saveinexternalfile/defaultcs.aspx

and

http://demos.telerik.com/aspnet-ajax/editor/examples/completehtmlsupport/defaultcs.aspx


All the best,
Rumen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Vuyiswa
Top achievements
Rank 2
answered on 24 Mar 2010, 09:23 AM
Thanks guys its working. I thought automatically the content property will give me the html evne if the toolbar is not used. i see now its fine.

Thanks
Tags
Editor
Asked by
Vuyiswa
Top achievements
Rank 2
Answers by
Rumen
Telerik team
Vuyiswa
Top achievements
Rank 2
robertw102
Top achievements
Rank 1
Share this question
or