Enable inline editing in widgets
By default, MVC widgets in Sitefinity CMS support the inline editing. You can also enable inline editing for custom widgets. For more information, see Implement inline editing for custom modules.
In addition to the default functionality, Sitefinity CMS allows you to enable inline editing using the InlineEditingAttributes and InlineEditingFieldAttributes helpers. This way, Sitefinity CMS automatically generates the required attributes, so you can have a cleaner markup.
To enable inline editing in MVC views, perform the following:
- Add
InlineEditingAttributesto your view.
To this methods, you must provideproviderName,type, andIdof the item that you want to be inline editable. - To enable the editing of particular field, add the
InlineEditingFieldAttributeshelper to thehtmlelement.
WhenInlineEditingFieldAttributesare presented to any html element, the entire text content becomes editable. - Provide the following parameters to
InlineEditingFieldAttributes:propertyName
The name of the property that you want to be editable.fieldType
This is the type of field that you want to be editable.
For example“ShortText”,“LongText”,“DateTime”,“FlatTaxon”,“HierarchicalTaxon”,“ChoicesCheckBoxes”,“ChoicesRadioButtons”,“ChoicesDropDown”,“YesNo”.
Use the following examples:
HTML+Razor
//Enable inline editing:
<li @Html.InlineEditingAttributes(Model.ProviderName, "Telerik.Sitefinity.News.Model.NewsItem", item.Id)>
</li>
//Enable editiong of a particular field:
<a @Html.InlineEditingFieldAttributes("Title", "ShortText") href="…">@item.Title</a>
Want to learn more?
Enhance your Sitefinity skills by enrolling in free training sessions. Become Sitefinity certified through Progress Education Community to strengthen your professional credentials.
Get started with Integration Hub | Sitefinity Cloud
This free lesson teaches administrators, marketers, and other business professionals how to use Sitefinity Integration Hub to create automated workflows between Sitefinity and other business systems.
Web Security for Sitefinity Administrators
This free lesson teaches administrators the basics about protecting your Sitefinity instance and your sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.
Foundations of Sitefinity ASP.NET Core Development
The free on-demand video course teaches developers how to use Sitefinity ASP.NET Core and take advantage of its decoupled architecture and modern development model.