Jhoon Bey Jhoon Bey - 1 year ago 101
HTML Question

<a> link not working by clicking, only work by "Open link in new tab" command

I meet this interesting situation:

@foreach (var item in Model)
<a href="@Url.Action("Details", "Product", new { id = item.Id })" >@item.Name</a>

When I click a link, nothing happen, product Details page does not open. But I do "Open link in new tab", then it opens. What can be it's reason?

Answer Source

You have some javascript code which is preventing the default action of the anchor tag to be executed. You could inspect the Network tab in FireBug to see if some AJAX request is being made when you click on the link. You could try excluding javascript files until you find the one that is doing this.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download