简体   繁体   中英

how to read text in bold,italic,underline and other html tags

I am working on application portal in asp.Net using C# and i am stuck on a problem. my work is when i save the contents of editor or text of textbox with html editor extender which are being applied effected , i mean when i apply effect on text like bold italic or any other which is in editor and when i save it then the text is like this:

<span style="font-weight: bold;">testing</span>

So is there any solution that when i apply the effect then the text is saved as bold or effected with any other control of editor.OR when i try to show that text then it will be read as it is as i had applied effect

the short demo is like following

textbox1.text=editor1.content;

then it will show the desirable result.

If I am understanding you correctly you would like the text of your control to appear with the same inline style properties that were stored via the HTMLEditor. I am not sure if this is directly possible without some custom parsing or further processing of the stored text. You could try to dynamically generate an HTMLGenericControl and then set the InnerHtml property to equal the text that was stored through the HtmlEditor. This has not been tested but something like this:

 var literalText = new HtmlGenericControl("span");
 literal.InnerHtml = editor1.content;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM