简体   繁体   中英

Asp.Net MVC Displaying Image in webpage?

I retrived 9 image paths from DB which i stored when user registers.... In one page i have to display 3 images in each row ...How to do that...

I created model class "FriendsList" with variable image Path and User id...

public String FriendImagePath
{
    get;
    set;
}

public int FriendUserId
{
    get;
    set;
}

And i created view model class and created a variable "FriendsList " of type Model class...

public List<FriendsList> FriendsList { get; set; }

I stored 9 values in this...

In .Aspx page i Have to display 3 row.. and in each row i have to display 3 image...

How to do this ???

<tr>

<td></td>

<td></td>

<td></td>

</tr>

<tr>

<td></td>

<td></td>

<td></td>

</tr>

<tr>

<td></td>

<td></td>

<td></td>

</tr>

I have to display like this

How to do this...

Thank you..

<table>
<tr>   
<% 
   int index=0;
   foreach(var friend in Model){ %>
      <% if(index%3==0){ %>
           </tr><tr>
      <% } %>   
    <td><img src="<%=Url.Content(friend.FriendImagePath) %>" /></td>
    //others prpoerties
<% 
   index++;
 } %>
</tr>
</table>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM