Travelling agency site: Create the Hotel and the Restaurant pages

These pages display detailed information about a specific hotel or restaurant. In addition, it gives suggestions about visiting other places in same city – restaurants or hotels. 

NOTE: Hotels and restaurants content types have similar structure and both hotel and restaurant pages are identical in design, so the tutorial guides you only through the creation of the Hotels page and you can create the other is in similar manner. 

Display the detail information about a city 

You can display detailed information about a hotel by dropping the Hotels widget on the page and configuring it to display only hotel’s details.

To do this, select the One particular hotel only... and do not select a specific hotel. This way, the hotels widget displays only details view of the currently navigated in URL hotel. For example ~/ hotel/united-states-of-america/new-york/the-edison-hotel. You also set the Details item template of the hotels widget to My Vacation - Full hotel content template.

The following screenshot shows the display of Hotels widget:

travelling agency12

Use the following markup for My Vacation - Full hotel content template:

To display information about the city (parent item) and the country (grandparent) of the currently displayed hotel, you can use chain Eval of ParentItem property like this: 

<%# Eval("ParentItem.ParentItem.Name") %> / <%# Eval("ParentItem.Name") %>

Display information about the parent item in the child template 

When you need to have more contextual information about the parent item, for example, a label See also Restaurants in New York, or display child items of the parent item from another type, you can extend the detail template of the hotel item.

The following screenshot shows the display of Hotels widget:

travelling agency13

This can be achieved by adding the following code to the template:

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?