Click here to Skip to main content
15,885,365 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When First time load the data is display in perfect,but after i have changed some style and save data.Again i show data then display html tags i.e, <strong>A<strong>


My full tinymce editor code

function initTextArea() {
tinyMCE.init({
mode: "exact",
theme: "advanced",
forced_root_block: false, // Start tinyMCE without any paragraph tag
encoding: "xml",
elements: '<%=txtEmail.ClientID %>',
editor_selector: "tinyMCE",

// plugins: "spellchecker,autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",

plugins: "paste",
paste_text_sticky: true,
setup: function(ed) {
ed.onInit.add(function(ed) {
ed.pasteAsPlainText = true;
});
},


theme_advanced_buttons1: "cut,copy,paste,|,undo,redo,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,|,outdent,indent",
theme_advanced_buttons2: "forecolor,backcolor,fontselect,fontsizeselect,|,search,replace",
theme_advanced_buttons3: "",
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align: "left",
theme_advanced_statusbar_location: "none",
spellchecker_languages: "English=en",

// Example content CSS (should be your site CSS)
content_css: "../../../Farvision.Common/script/tiny_mce/themes/advanced/skins/default/content.css",

// Drop lists for link/image/media/template dialogs
template_external_list_url: "lists/template_list.js",
external_link_list_url: "lists/link_list.js",
external_image_list_url: "lists/image_list.js",
media_external_list_url: "lists/media_list.js",

// Style formats
style_formats: [
{ title: 'Bold text', inline: 'b' },
{ title: 'Red text', inline: 'span', styles: { color: '#ff0000'} },
{ title: 'Red header', block: 'h1', styles: { color: '#ff0000'} },
{ title: 'Example 1', inline: 'span', classes: 'example1' },
{ title: 'Example 2', inline: 'span', classes: 'example2' },
{ title: 'Table styles' },
{ title: 'Table row 1', selector: 'tr', classes: 'tablerow1' }
],

// Replace values for the template plugin
template_replace_values: {
username: "Some User",
staffid: "991234"
}

});
}
initTextArea();

function fnExit() {
var redirectURL = '<%= Convert.ToString(Session["PageToRedirect"]) %>';
if (redirectURL == undefined || redirectURL == '')
redirectURL = '../../Farvision.Common/Common/Forms/R2_frmHome.aspx';
location.href = redirectURL;
return false;
}

var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_initializeRequest(InitializeRequest);
prm.add_endRequest(EndRequest);
var postBackElement;
function InitializeRequest(sender, args) {
if (prm.get_isInAsyncPostBack())
args.set_cancel(true);
postBackElement = args.get_postBackElement();
tinyMCE.execCommand('mceRemoveControl', false, '<%=txtEmail.ClientID %>');
}

function EndRequest(sender, args) {
initTextArea();
tinyMCE.idCounter = 0;

// replace textareaId by the id of your textarea
tinyMCE.execCommand('mceFocus', false, '<%=txtEmail.ClientID %>');
tinyMCE.execCommand('mceAddControl', false, '<%=txtEmail.ClientID %>');
}

function UpdateTextArea() {
tinyMCE.triggerSave(false, true);
}

var tdEmailID = '';

function SetEmailDiv() {
tdEmailID.find("[id*='hdnEmailCon']").val(escape(tinyMCE.activeEditor.getContent()));
var radCmbBox = $find('<%=cmbEmailType.ClientID %>');
tdEmailID.find("[id*='hdnEmailType']").val(radCmbBox.get_text());
document.getElementById("divEmailContent").style.display = "none";
}

function openEmailDiv() {
var pdiv = document.getElementById("divEmailContent");
pdiv.style.display = "inline";
pdiv.style.top = (parseInt(document.body.clientHeight) - parseInt(pdiv.style.height)) / 2 + 'px';
pdiv.style.left = (parseInt(document.body.clientWidth) - parseInt(pdiv.style.width)) / 2 + 'px';
return false;
}

function OnEmailEdit() {
var tr = $(this).closest("tr");
tdEmailID = tr;
tinyMCE.activeEditor.setContent(unescape(tr.find("[id*='hdnEmailCon']").val()));
var radComboBox = $find('<%=cmbEmailType.ClientID %>');
var item = radComboBox.findItemByText(tr.find("[id*='hdnEmailType']").val());
item.select();

return openEmailDiv();
}


here i think escape and unescape function is not working properly
Posted
Updated 14-Nov-20 0:55am
v3

1 solution

You Can Just Use @Html.Raw(@Model.textfile) To Display TinyMCE file text data in ASP.NET MVC EFcore

I Use Model To Pass My Data from controller To View You Can Use ViewBag Or ViewData for the option Of @Model Ex : @Html.Raw(ViewBag.textfile)
 
Share this answer
 
Comments
Richard Deeming 16-Nov-20 4:50am    
The OP mentioned an UpdatePanel, suggesting they were using ASP.NET WebForms. An answer about ASP.NET MVC is not relevant to the question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900