Reputation: 372
I have tried different syntax as belows.
"<img src='../Images/Live news/Actions-arrow-right-icon.png' />" ;
<img src="<%= Url.Content("~/Images/Live news/Actions-arrow-right-icon.png") %>"
I want to add image through controller not view so is these syntex are correct?
This is my full code
dt = Users.Get_Livenews(0, true, "GActive");
for (int i = 0; i < dt.Rows.Count; i++)
{
objExercise = new HomeModel();
objExercise.livenews = Convert.ToString(dt.Rows[i]["livenews_headline"].ToString()) + "<img src='../Images/Live news/Actions-arrow-right-icon.png' />" ;
Horizontal.Add(objExercise);
}
Upvotes: 0
Views: 687
Reputation: 365
You should get the list of image paths from controller and then iterate the this list at View level. Means dynamically create images for each image path you iterate.
If your view is strongly-typed and controller returns view with model or say list object then using for or foreach loop, you can prepare table or whatever you need.
Upvotes: 1