How do I open custom page?

Vote:
 

I have a page called hotel list, which lists hotels. Each hotel has a link called "View details". Clicking this hould open a page displaying hotel details.

How do I format the link to open the details page (hotelsDetails.aspx)?

What I have done so far:

-I have created pagetypes for both.
- I have createdthe pages in Edit mode. Hotel Details page is not shown in frontend menu.
- Hotel list page has a property 'hoteldetailspage' of type Page. It links to Hotel details page.

I'm using EPiServer v4.61

Any help appreciated.
#31460
Jul 31, 2009 12:51
Vote:
 

Fastest way is to use the episerver property control:

<EPiServer:Property PageLinkProperty="hoteldetailspage" runat="server" PropertyName="PageLink" />

Or you can add an href like this:

<a href='<%= GetUrl(CurrentPage) %>' title="View Details">
 View Details </a>

with the following method in codebehind:

protected string GetUrl(PageData page) {

 PageReference hotelDetailReference = page["hoteldetailspage"] as PageReference;
 PageData hotelDetailPage = null;

 if (hotelDetailReference != PageReference.EmptyReference)
   hotelDetailPage = GetPage(hotelDetailReference);

 return hotelDetailPage != null ? hotelDetailPage.LinkURL : "#";

}

#31761
Aug 11, 2009 12:46