EditableLiteral
in namespace DotVVM.BusinessPack.Controls
Renders a EditableLiteral control which can be edited by mouse click
Usage & Scenarios
EditableLiteral displays a bound value as text until you click it to edit in place. Press Enter to save the edit or Escape to discard it.
Sample 1: Editing a line item
Bind Text to a writable string property. Click the description, type a new name, and press Enter to update the line item. Press Escape instead to discard an edit. Leave RenderSpanElement enabled so the control has a clickable text element.
<p>Description (click to edit):</p>
<bp:EditableLiteral Text="{value: Description}" />
<p>Line item: {{value: Description}}</p>
using DotVVM.Framework.ViewModel;
namespace DotvvmWeb.Views.Docs.Controls.businesspack.EditableLiteral.sample1
{
public class ViewModel : DotvvmViewModelBase
{
public string Description { get; set; } = "Notebook";
}
}
Properties
| Name | Type | Description | Notes | Default Value | |
|---|---|---|---|---|---|
| ClientIDMode | ClientIDMode | Gets or sets the client ID generation algorithm. |
attribute
static value
|
Static | |
| DataContext | Object | Gets or sets a data context for the control and its children. All value and command bindings are evaluated in context of this value. The DataContext is null in client-side templates. |
attribute
bindable
|
null | |
| FormatString | String | Gets or sets the format string that will be applied to numeric or date-time values. |
attribute
static value
|
||
| ID | String | Gets or sets the control client ID within its naming container. |
attribute
static value
bindable
|
null | |
| IncludeInPage | Boolean | Gets or sets whether the control is included in the DOM of the page. |
attribute
static value
bindable
|
True | |
| InnerText | String | Gets or sets the inner text of the HTML element. Note that this property can only be used on HtmlGenericControl directly and when the control does not have any children. |
attribute
static value
bindable
|
null | |
| RenderSpanElement | Boolean | Gets or sets whether the literal should render the wrapper span HTML element. |
attribute
static value
|
True | |
| Text | String | Gets or sets the text displayed in the control. |
attribute
bindable
|
||
| ValueType | FormatValueType | Gets or sets the type of value being formatted - Number or DateTime. |
attribute
static value
|
Text | |
| Visible | Boolean | Gets or sets whether the control is visible. When set to false, `style="display: none"` will be added to this control. |
attribute
static value
bindable
|
True |