asp.net mvc - How to insert an image in ActionLink (View model) -


I want to display an image for every bike, but these codes are not working: < Pre> & lt; Ul & gt; @wunch (bike bike in model.back) {& lt; Li & gt; @ Html.ActionLink (bike name, "categories", new {id = bike.id, name = bike.name, @ class = "picture"}, null) & lt; / Li & gt; } & Lt; / Ul & gt;

Anyone can help me with this, thanks a lot!

I just updated my CSS file:

  a.image {background: URL ('~ / store project (new) / store project / adventure / content / Images '') Any repeat center correct; Display area; Height: 84px; Width: 264px; }    

There is no inbuilt HTML helpers for image hyperlinks. We have to make custom HTML to receive this requirement. So look at the links below, you will get an idea.

Based on your comment. I give such solutions:

  @if (Convert.ToString (bike.Name) == Tap || Convert.tostring (bike name) == "") {bike.Name = "Empty"; } @ Html.ActionLink (convert .tostring ("bike"), "Categories", New {@id = bike.Id, @name = bike.Name}, New {@ class = "image"})  / Pre> 

Here I have given "blank" bikes if the bike is there. Name is empty or empty.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -