如何使用嵌套的财产在tinyMCE的ASP.NET MVC工作 [英] How to work with nested property in tinyMCE in ASP.NET MVC

查看:151
本文介绍了如何使用嵌套的财产在tinyMCE的ASP.NET MVC工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用通过的NuGet作为样品的ASP.NET MVC的小MCE编辑模板。 在这个模板有如下在TinyMCE方法的调用:

  $('#@ ViewData.TemplateInfo.GetFullHtmlFieldName(的String.Empty))的TinyMCE({...});
 

在运行时,这会更改

  $('#fieldId)TinyMCE的。({...});
 

这是工作的罚款,直到这本是针对财产是模型本身。但是,当我提出内的财产另一个属性,它停止工作。现在现场就像是ModelView.SomeModel.TinyMceField。

我看着被呈现的code,它是:

  $('#MyModel.Description)的TinyMCE({...});
 

此前,这是:

  $('#说明)的TinyMCE({...});
 

ID字段从说明更改为 MyModel_Description 。所以,问题是不同的(。(点)和_(下划线))的文本区域和TinyMCE的方法调用中使用身份证。

如何解决此问题? 我应该改变:

  $('#@ ViewData.TemplateInfo.GetFullHtmlFieldName(的String.Empty))的TinyMCE({...});
 

解决方案

得到了解决:

  $('#@ ViewData.TemplateInfo.GetFullHtmlFieldId(的String.Empty))。TinyMCE的({...})
 

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({. . .})

这篇关于如何使用嵌套的财产在tinyMCE的ASP.NET MVC工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆