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.

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?