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

[Solved] MVC Editor Control with JQuery Template issue

2 Answers 142 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
nnk
Top achievements
Rank 1
nnk asked on 27 Dec 2010, 11:57 PM
The MVC Editor control emit a piece of javascript that looks like

<script type="text/javascript">document.getElementById('editor-value').style.display='none'</script>

I am trying to use the Editor within a JQuery Template ..(see below). No matter what I do, I end up with a script tag inside a script tag. Can the MVC Editor be used within a JQuery template at all? If yes, how do we do it?

<script id="Template_InlineTextLinks" type="text/x-jquery-tmpl">
<%=
Html.Telerik().Editor()
.Name("EditorForTextLinks")
.Tools(tools=>tools
.Clear()
.Bold()
.Italic()
.Underline()
.CreateLink()
.Unlink()
.InsertUnorderedList()
)
.ClientEvents(events => events.OnChange("Editor_onChange"))
%>
</script>

2 Answers, 1 is accepted

Sort by
0
Accepted
Jonathan
Top achievements
Rank 1
answered on 28 Dec 2010, 12:20 AM
It's not ideal according to the jQuery template dev, but you can use something other than a SCRIPT tag and it should work (I think). Example:

<div id="Template_InlineTextLinks" type="text/x-jquery-tmpl" style="hidden">
<%=
Html.Telerik().Editor()
.Name("EditorForTextLinks")
.Tools(tools=>tools
.Clear()
.Bold()
.Italic()
.Underline()
.CreateLink()
.Unlink()
.InsertUnorderedList()
)
.ClientEvents(events => events.OnChange("Editor_onChange"))
%>
</div>

keep in mind that you'll need to re-setup the editor once you've applied the template. Example:

$('#Template_InlineTextLinks').tmpl().appendTo($('#textlink1'));
$('#EditorForTextLinks').tEditor();


It'd be ideal if there was a way to NOT self init the control, and only output the necessary markup...

Cheers,
Jonathan
0
nnk
Top achievements
Rank 1
answered on 28 Dec 2010, 03:49 AM
Thanks Jonathan. Yes by using the div I can get the Editor to render. 
Many thanks for your help.
Tags
General Discussions
Asked by
nnk
Top achievements
Rank 1
Answers by
Jonathan
Top achievements
Rank 1
nnk
Top achievements
Rank 1
Share this question
or