How to work with nested property in tinyMCE in ASP.NET MVC

橙三吉。 提交于 2019-12-11 04:18:36

问题


Using the tiny MCE editor template in ASP.NET MVC provided as sample via Nuget. In this template there is a call to tinymce method as below:

$('#@ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty)').tinymce({ . . .  });

At runtime this changes to

$('#fieldId').tinymce({ . . . });

It was working fine until the property which this was targeting was in the model itself. But when I moved the property inside another property, it stopped working. Now the field is like ModelView.SomeModel.TinyMceField.

I looked at the code that was rendered, it is:

$('#MyModel.Description').tinymce({. . .});

Earlier this was:

$('#Description').tinymce({. . .});

The field id changed from Description to MyModel_Description. So the issue is the different ("." (dot) and "_" (underscore)) "id" used in textarea and tinymce method call.

How to solve this ? What should I change in :

$('#@ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty)').tinymce({ . . .  });

回答1:


Got the solution:

$('#@ViewData.TemplateInfo.GetFullHtmlFieldId(string.Empty)').tinymce({. . .})


来源:https://stackoverflow.com/questions/17137235/how-to-work-with-nested-property-in-tinymce-in-asp-net-mvc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!