We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

First time user: problems getting it to work

I'm learning ASP.NET MVC and I've made a sample website mostly using scaffolding.
Now I'm trying to tune it. I have a description field in my model which I want to use the RTE for when creating a new item or update an existing one.
I got the MVC545 NuGet package.

I'm first trying the alter the Create view.
Scaffolding created this for me:
[more fields]
        <div class="form-group">
            @Html.LabelFor(model => model.Height, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Height, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.Height, "", new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.LongDescription, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.LongDescription, new { htmlAttributes = new { @class = "form-control" } })*@
                @Html.ValidationMessageFor(model => model.LongDescription, "", new { @class = "text-danger" })
            </div>
        </div>
[more fields]

For LongDescription I want to use the RTE.
On top of this page I added:
<script src="@Url.Content("~/Scripts/jquery.globalize.min.js")"></script>
<script src="@Url.Content("~/Scripts/globalize/cultures/globalize.culture.nl-NL.js")"></script>

And the @Html.EditorFor line I changed to 
@{Html.EJ().RTE("rteSample").Width("100%").ContentTemplate(@<p>Test</p>).Render();}

When I view this page in my browser I see my textbox is changed to a textarea, so something is working. But I don't have the toolbar and the content is not parsed it just says '<div><p>Test</p></div>'

I also don't understand how to add the current value of the field in the RTE.
I tried this:
@{Html.EJ().RTE("rteSample").Width("100%").ContentTemplate(@model.LongDescription).Render();}
but that is giving a compile error.

Sorry for these noob questions. I've search the FAQ and the KB but couldn't find the answer.

Thanks,
Paul


12 Replies

PM Paul Meems April 10, 2015 09:01 AM UTC

Just after posting my question I did a forum search again and found a similar question posted a few days ago: https://www.syncfusion.com/forums/118431/rte-not-loading
One of the answers had a link to a manual which helped me a lot. It is now working.


KC Kasithangam C Syncfusion Team April 13, 2015 05:43 AM UTC

Hi Paul

Thanks for the update.Please let us know if you need any assistance.

Regards,

Kasithangam



PM Paul Meems April 23, 2015 07:34 PM UTC

I've got my RTE working, but the content is erased when I change another textbox.

This is my code:
var scripts = new List<string> { "superscript", "subscript" };
@Html.EJ().RTEFor(model => model.LongDescription, new { htmlAttributes = new { @class = "form-control" } }).Tools(tool => tool.Scripts(scripts)).ShowFooter(true)

I have a form with another RTE, several image browser controls, several text boxes, a few select boxes and some checkboxes.
When I edit an entry and add some content to my RTE and save the form, all changes are saved.
When I edit again and add text to my RTE and save again, all is well.
But when I edit again, don't change my RTE but modify one of my text boxes and save again, my RTE is empty after viewing.

What am I doing wrong?

This is my model:
        [DataType(DataType.Html)]
        [AllowHtml]
        [Display(Name = "Long Description")]
        public string LongDescription { get; set; }

Thanks,

Paul


KC Kasithangam C Syncfusion Team April 24, 2015 12:38 PM UTC

Hi Paul,

Sorry for the inconvenience caused.

We are unable to reproduce the issue “RTE content gets empty after modify the textbox”.We have prepared the sample based on your requirement and please find the sample under the following location,

Sample: Sample
Could you please check with the above sample? Still, if you face any problem please revert us by modifying the sample based on your application along with replication procedure. This would be helpful for us to serve you.

Please let us know if you have further queries,

Regards,

Kasithangam



PM Paul Meems April 29, 2015 01:12 PM UTC

Thanks for the sample.
I'm having trouble running it. Most likely because I use the 4.5 version of syncfusion and compile for .NET v4.5

I tried moving the sample to .NET4.5 and reference the syncfusion dlls from my project. But now I get this error:
CS0121: Ambiguous call to Syncfusion.MVC.EJ.JavaScriptExtension.EJ<WebApplication6.Models.item>(System.Web.Mvc.HtmlHelper<WebApplication6.Models.item>) and Syncfusion.MVC.EJ.JavaScriptExtension.EJ<WebApplication6.Models.item>(System.Web.Mvc.HtmlHelper<WebApplication6.Models.item>)
The above error is translated by me to English.

When I look at the code I see some unfamiliar stuff in the controller:
            RTEproperties x = new RTEproperties();
            x.EnableRTL = true;
            ViewData["val"] = x;
            EditorProperties editor = new EditorProperties();
            editor.EnableRTL = true;
            ViewData["editmodel"] = editor;
I'm not sure what it means.

I've attached my project. I use the RTE editors in Stallions/Edit.
To make the zip as small as possible I removed the package folder.

Thanks,
Paul



KC Kasithangam C Syncfusion Team April 30, 2015 12:33 PM UTC

Hi Paul,

Query 1: CS0121: Ambiguous call to Syncfusion.MVC.EJ.JavaScriptExtension.EJ(System.Web.Mvc.HtmlHelper) and Syncfusion.MVC.EJ.JavaScriptExtension.EJ(System.Web.Mvc.HtmlHelper)

We would like to let you know that, the above issue might have occurred because of the version mismatch. (We noticed that the reference DLL’s added in the sample are in one version and added the assembly reference “Syncfusion.EJ” and “Syncfusion.EJ.MVC” in web.config file in another version)

Sample provide by us in the last update is in the version 12.4.0.24. If you have upgraded our any other versions means, please add the assembly reference in the web.config file based on the DLL’s, which is going to be used in your project. Also, please let us know the version details of your sample.

Query2: When I look at the code I see some unfamiliar stuff in the controller:

RTEproperties x = new RTEproperties();

x.EnableRTL = true;

ViewData["val"] = x;


The above code is used in controller and we have added properties for the RTE control by using the RTE properties builder.


I've attached my project. I use the RTE editors in Stallions/Edit.


We have not find any attachment with your last update. Could you please update us the sample file again that would be helpful for us to isolate the issue?

Please let us know if you have further queries.

Regards,

Kasithangam



PM Paul Meems April 30, 2015 12:43 PM UTC

Here's my project again.
It says 'upload successful'. 
Attached file: Syncfusion118801_739af8af.zip

I'll try to upgrade my project to .NET v4.5.1 and the latest Syncfusion package.
Do you have a document explaining how to upgrade your packages?

Thanks,

Paul

Attachment: Syncfusion118801_739af8af.zip


KC Kasithangam C Syncfusion Team May 1, 2015 10:43 AM UTC

Hi Paul,

Thanks for your update.
We have checked with your sample.We found that, there is 13.1.0.21 version is used in your sample.Currently “RTEFor control doesn’t render in 13.1.0.21” as bug, and this issue has been fixed in our latest service pack release(v13.1.0.26) 2015 and is available for download under the following link:

http://www.syncfusion.com/forums/118977/essential-studio-2015-volume-1-service-pack-release-v13-1-0-26-available-for-download

Query: Do you have a document explaining how to upgrade your packages?

We have showcased the files that are required while upgrading to higher version in the following user guide documentation link,

http://help.syncfusion.com/ug/js/index.html#!Documents/upgradetohigherversion.htm

Please make use of the above documentation link and please let us know if you require any other assistance.

Regards,

Kasithangam



PM Paul Meems May 1, 2015 08:56 PM UTC

I still have the same problem. The content of the RTE is still cleared after saving the form.

I installed Essential Studio v13.1.0.21. I still had v12. Next I installed the servicepack v13.1.0.26
Next I copied the js files from D:\Program Files (x86)\Syncfusion\Essential Studio\13.1.0.26\JavaScript\assets\scripts to <mysolution>\Scripts\ej\
Now I opened the solution and changed to references to the SyncFusion dlls to D:\Program Files (x86)\Syncfusion\Essential Studio\13.1.0.26\precompiledassemblies\13.1.0.26\4.5

I compile the project again and run it.
I open the edit form change the value of one of the textboxes and save the form.
The content in the RTE is cleared.

Do I need to do something with NuGet?
Before the update the references were in  <HintPath>..\packages\Syncfusion.ASPNETMVC545.13.1.0.21\lib\net45\Syncfusion.Core.dll</HintPath>

I attach my updated solution.

Please assist further.

Thanks,
Paul

Attachment: Syncfusion1188012_ad24b925.zip


KC Kasithangam C Syncfusion Team May 4, 2015 05:12 PM UTC

Hi Paul,

We have checked with your sample, but it is not in a runnable state.We have prepared a video until sample gets worked at our end.Could you please update us the issue reproducible sample with procedure to reproduce the issue? This will help us to provide you an appropriate solution.

Sample video download link:
http://www.syncfusion.com/downloads/support/forum/118801/RTE1035548707.zip

Please let us know if you have further queries,

Regards,
Kasithangam



PM Paul Meems May 7, 2015 10:11 AM UTC

Thanks for the reply.

I can't run your samples and you cannot run mine. That might be an indication something is wrong at my end.
As said this project is my first attempt in the MVC world and also my first attempt of using your great web controls.
I've been using your WinForms controls.

I use Visual Studio Professional 2013 Update 4. I've installed Syncfusion Essential Studio v13.1.0.26.
Other configurations:
Windows 8.1
.NET framework v4.5.2 (just installed)
My project is compiled for .NET framework v4.5 and I have a reference path to 'D:\Program Files (x86)\Syncfusion\Essential Studio\13.1.0.26\precompiledassemblies\13.1.0.26\4.5\'
NuGet packages: bootstrap, jquery, Glimpse, Syncfusion.ASPNETMVC545 v13.1.0.26, SyncfusionJavascript v13.1.0.26

Looking at your video I see you change the color textbox and save, but I don't see you editing that entry again. Because the RTE value is only cleared after saving. I can see in the list that the value is missing and the edit form confirms it.

Later this week I'll start over again with a fresh MVC5 project, with only a simple model and I'll test the RTE again. As long as it keeps working I'll add more complexity to my models.
I'll let you know my progress.

Thanks,
Paul



KC Kasithangam C Syncfusion Team May 8, 2015 04:55 AM UTC

Hi Paul,

Thanks for your update.We will wait to hear from you.

Please let us know if you have further queries.

Regards,

Kasithangam


Loader.
Up arrow icon