Sample: Profile widget with custom fields
Overview
This sample demonstrates how to add your own custom fields to the default template of the Profile widget. You do this by modifying the Default.cshtml of the Profile widget and then apply the new template to the widget.
For more information, see Profile widget.
Supported field types
For the Profile widget, Sitefinity supports the following field types:
- Short text
- Long text
- Yes / No
- Date and Time
- Number
Create the custom widget template
Create a custom template for the Profile widget in the following way:
- Open your project in Visual Studio.
- In folder
Views/Shared/Components
, create a new folder and name it SitefinityProfile
- In the context menu of folder
SitefinityProfile
, click Add » New Item…
- Name the file ProfileWithCustomFields.cshtml
- Paste the code in the template and build your solution
Apply the CAPTCHA template
Perform the following:
- Open the page where the Profile widget is located for editing.
- In the page editor, hover over the Profile widget.
- Click the toggle menu in the widget label.
- Click
(Edit).
- In the Profile template dropdown box, select the new template.
- Save your changes.