0

When I click on links they do not seem to work. When I right click them and open in a new tab they open correctly.

I can't figure out the reason for this behavior.

Here is the code for my _layout.cshtml file

<!DOCTYPE html>
<html>
<head>
    ...
    <!-- Roboto -->
    <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:400,500,700">

    @Styles.Render("~/Content/css")
    @Styles.Render("~/Content/ratchet")
    @Scripts.Render("~/bundles/modernizr")
    @Scripts.Render("~/bundles/ratchet")

</head>
<body>

    <div class="content">
        @RenderBody()
    </div>
    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/bootstrap")
    @RenderSection("scripts", required: false)
</body>
</html>

And here is an example of a link I'd put in index.cshtml

  <a href="@Url.Action("NewList", "Home", null)">Submit</a>
  <a href="/Home/NewList">Submit 2</a>

Both static and generated behave the same leading me to think this is a Ratchet issue.

EDIT 1 Apparently even the toggle is not working (again no JS errors)

<div class="toggle active">
  <div class="toggle-handle"></div>
</div>
<div class="toggle">
  <div class="toggle-handle"></div>
</div>

It works in a plain HTML template so I must assume this is from a .Render issue?

http://goratchet.com/components/

EDIT 2:
Many of the components don't seem to be working, I've found a way to bypass this issue by replacing the links with forms that have a submit button and hidden values to POST to the required Action. Terrible for the UI but at least the buttons are working.

Raed
  • 519
  • 1
  • 6
  • 23

3 Answers3

0

Do you have both regular and .min versions of ratchet so it can be loaded via your /bundles/ratchet bundle? Make sure you have both, or if you only have the debug versions that you are running in debug mode (or if you have only the .min versions that you are running not in debug mode)

solidau
  • 4,021
  • 3
  • 24
  • 45
0

Sometimes “HTTP Error 404.0 - Not Found” error is encountered when calling the view. One of the possible cause for this error just a dot (.) in the href. In case this problem is caused from the same issue try as below (attention to dot):

<a href="@Url.Action("NewList", "Home")">Submit</a>
<a href="./Home/NewList">Submit 2</a>

Update:

When creating a link to a controller action in ASP.NET MVC, using the generic ActionLink method is preferable, because it allows for strongly typed links that are refactoring friendly:

@Html.ActionLink("NewList", "Home") 

Hope this helps...

Murat Yıldız
  • 11,299
  • 6
  • 63
  • 63
  • Same issue, Links appear to be correct when I hover (and when I right click and open in a new tab) but they don't seem to click when simply clicking on them. Buttons work tho. I double checked all the JS files and even CSS, very strange. – Raed Apr 05 '15 at 21:37
  • Have you tried with dot(.)? On the other hand try to use "@Url.Action" without "null" parameter as on my updated code? – Murat Yıldız Apr 05 '15 at 21:40
  • Yes I have tested your updated code. They don't seem to be clickable. I have been working on this for a week, I think I'm going to just turn every link to a button and call it a day. – Raed Apr 05 '15 at 21:42
0

I would suggest you to move the links from body to head.

 @Scripts.Render("~/bundles/jquery")

 @Scripts.Render("~/bundles/bootstrap")

Move them to head section once.

Nilesh Thakkar
  • 1,442
  • 4
  • 25
  • 36
Ganesh Todkar
  • 507
  • 5
  • 12