Skip to content

933177: Added code to disable content control using cc properties #4117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: hotfix/hotfix-v29.1.33
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 45 additions & 1 deletion ej2-asp-core-mvc/document-editor/content-control.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,53 @@ container.documentEditor.editor.insertContentControl('Picture');
container.documentEditor.editor.insertContentControl('Picture', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADgSURBVEhLY3jx4sV/WuDBafCluXH/D6ydhlWObIMPLmn8/32KPBiD2OjyKAY7+zbDsX945/91azehiBWU9IPVgVwJMxSX4SgG65jXwrGVa+v/6TOXoojBDEZ2LQh/m676/+D+/XBzQJgsg0EY5GqQgSCDsYUz2QaDMCiosIUvCKMYDFKIjK9dvYrCB3kXJIaMkfUjY5JdDEpioCCAYZCFyGbAMFkGI0fcMDUYpAgZY4s8EEYWwxWBJLsYhJHFQIYjmwHDQ9xgkGEwDCp0QAYji8EMRhYjymBq4lGDofjFfwCV5AGEIf9DQQAAAABJRU5ErkJggg==');
{% endhighlight %}

## Content Control Properties

Content control properties [`ContentControlInfo`] can be set using the [`setContentControlInfo`]

* title : Specifies the title of the content control.
* tag: Specifies the tag associated with the content control.
* value: Specifies the value of the content control.
* canDelete: Specifies whether the content control can be deleted.
* canEdit: Specifies whether the content control can be edited.
* items: Specifies items for the content control, applicable if the type is combobox or dropdownlist.
* type : Specifies the type of content control.
* xmlString: Specifies the XML string used for data binding, XML content to be mapped within the content control.
* xmlPath?: Specifies the XPath expression for XML mapping, This path identifies the specific part of the XML data to bind to the content control.

### Prevent Editing Content Control in Document editor control

Document Editor content control can prevent editing using the ContentControlInfo properties.

The following example illustrates how to prevent editing the content control after inserting the content control in DocumentEditorContainer.

{% highlight ts %}
container.documentEditor.editor.insertContentControl('RichText','{{product_code}}');
var contentControlInfo = container.documentEditor.selection.getContentControlInfo();
//Specifies whether the content control can be Edited.
// Use "true" to restrict editing of the content control, and "false" to allow editing.
**contentControlInfo.canEdit = true;**
container.documentEditor.editor.setContentControlInfo(contentControlInfo);
{% endhighlight %}

### Prevent Deleting Content Control in Document editor control

Document Editor content control can be prevented from being deleted using the ContentControlInfo properties.

The following example illustrates how to prevent deleting the content control after inserting the content control in DocumentEditorContainer.

{% highlight ts %}
container.documentEditor.editor.insertContentControl('RichText','{{product_code}}');
var contentControlInfo = container.documentEditor.selection.getContentControlInfo();
//Specifies whether the content control can be Deleted.
// Use "true" to prevent the deletion of the content control, and "false" to allow its removal.
**contentControlInfo.canDelete = true;**
container.documentEditor.editor.setContentControlInfo(contentControlInfo);
{% endhighlight %}

## Import content control properties

Content control properties can be set using the `ContentControlInfo` and import it using `importContentControlData`
Content control properties can be import using `importContentControlData`

{% highlight ts %}
var data = [];
Expand Down