Bug tracker: Create the ProjectMaster view

The ProjectMaster view displays the list of available projects. The view is represented by a Razor web page. To create the view:

  1. In Visual Studio, navigate to the Areas  BugTracker  Views  Project folder and create a new file with the cshtml extension.
    Name the class ProjectMaster.
  2. Add using statements to the following namespaces:
    • Telerik.Sitefinity.Model
    • Telerik.Sitefinity.DynamicModules.Model
  3. Define the type of the Model property.
    Use the same type as the type of the data that you passed as the model argument to the View method in the project controller.
  4. Create an HTML entry for each of the projects in the query:
    1. Create an unordered list element.
    2. Inside the tag of the list, use foreach and create a list item element for each project.
    3. As content of the list item element, create a hyperlink by using the ActionLink method.
      This link must navigate to the view containing the list of bugs for the project.
    4. Pass the Title of the project as the linkText argument.
    5. Pass Index as the actionName argument.
    6. Pass Bug as the controllerName argument.
    7. Create an anonymous type containing the ID parameter and pass it as the routeValues argument.
    8. As the htmlAttributes argument pass null.
      The generated URL will look similar to this one: http://localhost/Bug/Index/EAC1A302-76E3-4E0E-B314-B56CB76E6562. This means that the Index action in the BugController class will be executed and the route values will contain the ID of the respective project.

GITHUB EXAMPLE: For more information about the content of the file, see the ProjectMaster.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?