Create the BugForm view

After you create the BugModel class, you create the BugForm view. The BugForm view represents a form that is used by the user to log a new bug. To create the BugForm view:

  1. In Visual Studio, navigate to the Areas » BugTracker » Views » Bug folder, create a new file with the cshtml extension.
    Name the file BugForm.
  2. Add using statements to the following namespaces:
    • Telerik.Web.Mvc.UI
    • Telerik.Sitefinity.Model
    • Telerik.Sitefinity.DynamicModules.Model
  3. Set the layout of the view.
    Use the BugTrackerLyout view as the layout.
  4. Define a form:
    1. Use the BeginForm method of the HtmlHelper object.
    2. Specify the action, controller and the route values. The form navigates to the specified URL after it is submitted.
    3. Specify the method of the form to be FormMethod.Post.
      Note that you have to put the call to the BeginForm method inside a using clause.
  5. Define the input fields:
    1. Inside the using clause for the BeginForm method, create a fieldset element.
    2. Inside the element define the input fields for the bug details.
      When defining the choice fields, set their values to the same values as the one defined for the Bug content type in the custom module. Note that the names of the input fields must be the same as the names of the properties of the BugModel class.

GITHUB EXAMPLE: For more information about the content of the file, see the BugForm.cshtml file of the downloaded sample project.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Web Security for Sitefinity Administrators

The free standalone Web Security lesson teaches administrators how to protect your websites and Sitefinity instance from external threats. Learn to 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 .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?