简体   繁体   English

使用插件将字段设置为只读

[英]Set a field readonly with a plugin

I've been looking through the net but can't find a proper answer... 我一直在网上搜索,但找不到正确的答案...

I wrote a plugin in C# and when a condition is met, I would like to set a field readonly... 我用C#编写了一个插件,当满足条件时,我想将字段设置为只读...

Thanks in advance ! 提前致谢 !

I think the problem you are running into is that you cant modify a field's enabled/disabled from the plugin. 我认为您遇到的问题是您无法通过插件修改字段的启用/禁用状态。

You can, however, access the fields from javascript: 但是,您可以从javascript访问字段:

Xrm.Page.getControl('yourfieldname').setDisabled(true);

Here is info on how to setup the javascript for your forms: microsoft's form programming reference 以下是有关如何为表单设置javascript的信息: Microsoft的表单编程参考

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM