Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set image path dynamically in MVC 3 RAZOR

How to set image path dynamically for following:

<img src="/Images/Model" + @item.ModelImagePath />

"/Images/Model" this path is fixed, rest of the path comes from [ModelImagePath] column of Model DBTable.

Please guide me how to set the path dynamically in View.

And is there any Html helper tag to display image available in MVC RZOR?

Note: i have similar type of problem as described in

How to use/pass hidden field value in ActionLink

like image 632
Paul Avatar asked May 07 '12 02:05

Paul


1 Answers

<img src="@Url.Content(String.Format("~/Images/Model/{0}", item.ModelImagePath))"
like image 56
David Peden Avatar answered Sep 29 '22 16:09

David Peden