faisal1208 faisal1208 - 4 months ago 14
HTML Question

adding image in url action link inside input button?

I want to add image button inside an input button which has url.action method

<input type="button" class="btn btn-primary" value="View Chart" onclick="location.href='@Url.Action("Multigraph", "Home")'"/>

Actually i want to do this

On click of the image i will be able to go to the specific view

I have also looked into this link

Any help will be appreciated


You could style the input button with css.

.btn--graph {
    width: 110px;
    height: 93px;
    background-image: url('http://i.stack.imgur.com/jCvdY.jpg');
<input type="button" class="btn btn-primary btn--graph" onclick="location.href='@Url.Action("Multigraph", "Home")'"/>

However if this button is actually a link to another webpage. It would semantically be more correct to use an anchor link.

<a href="@Url.Action("Multigraph", "Home")">
  <img src="http://i.stack.imgur.com/jCvdY.jpg" alt="View Chart">