문제

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({ . . .  });
도움이 되었습니까?

해결책

Got the solution:

$('#@ViewData.TemplateInfo.GetFullHtmlFieldId(string.Empty)').tinymce({. . .})
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top