how to fix linking pages with on another in same website

39 views Asked by At

I've created a default mvc web application in visual studio 2017. the issue i'm facing is when i run this application it shows me the main interface and after it when i click the contact us page in header it shows nothing. kindly help me how to put link interconnection between them. i've already tried @actionlink

<!-- The navigation menu -->
<div class="navbar">
    <a class="active" href="@Html.ActionLink("Home", "Index", "Home")">Home</a>
    <a href="#">Clothing</a>
    <a href="#">Contact</a>
    <a href="#">Track Order</a>

2

There are 2 answers

0
AjayGohil On

Try this code for provide an action link on click event

<div class="navbar">
<a class="active" href="@Html.ActionLink("Home", "Index", "Home")">Home</a>
<a href="#">Clothing</a>
<a href="@Url.Action("Contact", "Home")" >Contact</a>
<a href="#">Track Order</a>
0
LazZiya On

@Html.ActionLink("Home", "Index", "Home") creates an anchor tag <a href="/Home/Index">Home</a>,

@Url.Action("Home", "Index") creates a url /Home

so you can use this:

<!-- The navigation menu -->
<div class="navbar">
    @Html.ActionLink("Home", "Index", "Home")
    <a href="#">Clothing</a>
    <a href="#">Contact</a>
    <a href="#">Track Order</a>

or this:

<!-- The navigation menu -->
<div class="navbar">
    <a class="active" href="@Url.Action("Home", "Index")">Home</a>
    <a href="#">Clothing</a>
    <a href="#">Contact</a>
    <a href="#">Track Order</a>