Reputation:
i am creating a web app in mvc-5
here is my actionlink button which looks like
<p>
<span class="btn btn-success glyphicon glyphicon-plus">
@Html.ActionLink(" ", "insert")
</span>
</p>
when a user clicks on this button he should be redirected to the following page
public ActionResult insert()
{
return View();
}
but nothing is happening when i am clicking the button
what i need to do?
Upvotes: 1
Views: 3582
Reputation:
Because you not generating any text in the link, there is nothing to 'click'.
Change your code to generate a link containing the <span>
element
<p>
<a href="@Url.Action("insert")">
<span class="btn btn-success glyphicon glyphicon-plus"></span>
</a>
</p>
Upvotes: 1
Reputation: 2890
Your link format doesn't look correct.
You've only got
@Html.ActionLink(" ", "insert")
Add your "Link text", action and controller name and you should be ok.
@Html.ActionLink("Link Text", "YourAction", "YourController")
NOTE : There are 9 overloads for ActionLink allowing you to omit the controller (among other things )if the link target is handled by the same controller.
Hope that helps
Upvotes: 3