At this point do you know the Url of the page you plan to link to ?
eg
<p>To find out if you are eligible for funding please enter your postcode into the search. If applying for funding in Scotland select <a href="http://www.fundingscotland.com/eligible">here</a> </p> <br> <br> <br>
or is that url a page somewhere in your Umbraco site and you are wondering how to find it and refer to it in the razor file ?
Depending on your approach to the structure of the site you could use the Umbraco Helpers here to find the page:
eg if your funding page had a specific document type alias...
@{
string locations = @Locations.GetJSON();
string divClass = (@Model.Id == 3437) ? "map" : "funding";
var fundingPage = Umbraco.TypedContentSingleAtXPath("//fundingPageAlias");
var fundingPageUrl = fundingPage.Url;
}
<p>To find out if you are eligible for funding please enter your postcode into the search. If applying for funding in Scotland select <a href="@fundingPageUrl">here</a> </p> <br> <br> <br>
or if your funding page didn't have a specific document type alias, you could create a property on the homepage of the site called 'funding page'
and make this a content picker, and pick the particular page here. Then in your razor file, you could get a reference to the homepage of the site, read the picker property, and get the url of the picked item.
How can I make text hyperlink in cshtml script
Hi there
i have the following script;
Where here is the hyperlink text to a url. Can someone please help?
Hi Tony
At this point do you know the Url of the page you plan to link to ?
eg
or is that url a page somewhere in your Umbraco site and you are wondering how to find it and refer to it in the razor file ?
Depending on your approach to the structure of the site you could use the Umbraco Helpers here to find the page:
https://our.umbraco.org/documentation/reference/querying/umbracohelper/
eg if your funding page had a specific document type alias...
or if your funding page didn't have a specific document type alias, you could create a property on the homepage of the site called 'funding page' and make this a content picker, and pick the particular page here. Then in your razor file, you could get a reference to the homepage of the site, read the picker property, and get the url of the picked item.
Hi Marc Many thanks for this solution. I just used a href="url of page" with the relevant coding as you suggested.
This has worked well and takes you to a hidden page that would be only accessible if a qualifying postcode was entered in the postcode search.
tony
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.