Products Technologies Demo Docs Blog Support Company

ASP.NET: Protected SubTextParts in TXTextControl.Web

SubTextParts in TX Text Control define named text ranges with Start, Length, and Name properties. Version X14 adds subTextPartEntered and subTextPartLeft events to the HTML5-based Web.TextControl, allowing developers to switch editMode and create read-only document sections.

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

  • 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

TX Text Control X16 provides two approaches to conditionally render merge blocks within MailMerge templates. Setting RemoveEmptyBlocks removes blocks when child data is absent, while…


ReportingWindows FormsMail Merge

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

The TX Text Control DocumentServer namespace ships with seven ready-to-use reporting dialogs for data selection tasks: chart data relations, filter and sort, database connection, data source…


ReportingMail MergeRelease

Merge Blocks in X16: Filtering, Sorting and Conditional Rendering

TX Text Control X16 introduces programmatic merge block insertion through the DataSourceManager API, supporting inline filtering, sorting, and conditional rendering. Block merging conditions…


ASP.NETForm FieldsHTML5

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

TX Text Control X15 adds JavaScript API support for inserting and modifying MS Word compatible fields in the HTML5-based ASP.NET editor. MergeFields, TextFields, and ApplicationFields can be…


ASP.NETHTML5Release

X15: Inserting Client-Side Images using JavaScript

TX Text Control X15 adds JavaScript ImageCollection methods to insert client-side images into the HTML5-based ASP.NET editor. A local file is read and converted to a Base64 string, then placed…

Share on this blog post on: