ASPxRichEdit.ClientInstanceName Property
Specifies the ASPxRichEdit‘s client programmatic identifier.
Namespace: DevExpress.Web.ASPxRichEdit
Assembly: DevExpress.Web.ASPxRichEdit.v24.2.dll
Declaration
Property Value
Type | Default | Description |
---|---|---|
String | String.Empty | The control’s client identifier. |
Remarks
Use the ClientInstanceName property to specify a unique client-side identifier for the ASPxRichEdit control. Use this identifier on the client side to access the ASPxClientRichEdit object programmatically.
Example
<script type="text/javascript">
function getAllText() {
return RichEdit.document.activeSubDocument.text;
}
function getSelectedText() {
var firstSelectedInterval = RichEdit.selection.intervals[0];
var selectedText = RichEdit.document.activeSubDocument.text.substr(firstSelectedInterval.start, firstSelectedInterval.length);
return selectedText;
}
</script>
<dx:ASPxButton runat="server" ID="Button1" Text="Get All Text" AutoPostBack="false">
<ClientSideEvents Click="function(s, e) { alert(getAllText()); }" />
</dx:ASPxButton>
<dx:ASPxButton runat="server" ID="Button2" Text="Get Selected Text" AutoPostBack="false">
<ClientSideEvents Click="function(s, e) { alert(getSelectedText()); }" />
</dx:ASPxButton>
<dx:ASPxRichEdit ID="RichEdit" runat="server" ClientInstanceName="RichEdit">
</dx:ASPxRichEdit>
The ClientInstanceName property is important when a control is contained within a naming container, for instance, within an ASPxPageControl‘s page or an ASPxPopupControl‘s window.
If the ClientInstanceName property is not specified for a control, the control’s client identifier is generated automatically and equals the value of the control’s ID property. Note that in this case, client-side programmatic access to the control is not allowed when the control is contained within a naming container.
Special Characters in Client Instance Name
If the ClientInstanceName
property contains special characters, for instance, the dot (.
), you cannot access a client object by this name. Call the GetByName(name) method to retrieve the client-side object instead.
<dx:ASPxTextBox ... ClientInstanceName="SomeType.SomeProp" />
var txt = ASPxClientControl.GetControlCollection().GetByName("SomeType.SomeProp");
txt.SetText("Some Text");