开发者

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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜