Products Technologies Demo Docs Blog Support Company

ASP.NET: Protected SubTextParts in TXTextControl.Web

SubTextParts ? TX Text Control .NET for Windows Forms ? TXTextControl Namespace ? SubTextPart Class A SubTextPart object represents a user-defined part of a TX Text Control document. were introduced in version X13 (23.0) as a new document element to realize the new MailMerge merge block concept. But this feature can be used for many other tasks as well. In general, a SubTextPart ? TX Text Control .NET for Windows Forms ? TXTextControl Namespace ? SubTextPart Class A SubTextPart object…

ASP.NET: Protected SubTextParts in TXTextControl.Web

SubTextParts were introduced in version X13 (23.0) as a new document element to realize the new MailMerge merge block concept. But this feature can be used for many other tasks as well.

In general, a SubTextPart is a defined range of text with a Start, a Length and a Name. This name can be used to tag a SubTextPart to be protected. If the user enters this SubTextPart, the editMode can be used to set TextControl to read only.

Version X14 (24.0) implements new events for the HTML5-based TXTextControl.Web: subTextPartEntered and subTextPartLeft. Both events return the event argument SubTextPartEventArgs object.

On leaving the SubTextPart, the subTextPartLeft is used to switch back to edit mode.

The following JavaScript code shows this easy implementation:

function subTextPartEnteredHandler(e) {
    if (e.name == "protected")
        TXTextControl.editMode = TXTextControl.EditMode.ReadAndSelect;
}

function subTextPartLeftHandler(e) {
    TXTextControl.editMode = TXTextControl.EditMode.Edit;
}

TXTextControl.addEventListener("subTextPartEntered", subTextPartEnteredHandler);
TXTextControl.addEventListener("subTextPartLeft", subTextPartLeftHandler);

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Also See

This post references the following in the documentation:

TX Text Control .NET Server for ASP.NET

  • TXTextControl.ServerVisualization.TextViewGenerator.SubTextPartEntered Event
  • TXTextControl.ServerVisualization.TextViewGenerator.SubTextPartLeft Event
  • TXTextControl.SubTextPart Class
  • TXTextControl.Web Namespace

TX Text Control .NET for Windows Forms

  • TXTextControl.SubTextPart Class
  • TXTextControl.SubTextPart.Length Property
  • TXTextControl.SubTextPart.Name Property
  • TXTextControl.SubTextPart.Start Property
  • TXTextControl.TextControl.EditMode Property

Related Posts

ReportingWindows FormsMail Merge

MailMerge: Conditional Rendering of Merge Blocks

Merge blocks can be used to render content conditionally. This article explains different ways to control this.


ReportingWindows FormsMail Merge

DataSourceManager: Using the Ready-to-Use Reporting Dialog Boxes

The Text Control DocumentServer class comes with ready-to-use dialog boxes for various purposes. This article shows how to use them in your application.


ReportingMail MergeRelease

Merge Blocks in X16: Filtering, Sorting and Conditional Rendering

Merge blocks have been drastically improved in TX Text Control X16: They can be sorted, filtered and rendered based on conditions.


ASP.NETForm FieldsHTML5

X15: Adding MS Word Compatible Fields and Form Elements to TXTextControl.Web

This article explains how to insert MS Word compatible form fields and form elements to documents.


ASP.NETHTML5Release

X15: Inserting Client-Side Images using JavaScript

Using JavaScript API enhancements, client-side images can be added to documents. This article shows how to add a client-side image using a file input form element.