0

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

1 Answer 1

1
<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>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.