<table> @{ int j = 0; for (int i = 0; i < Model.Count(); i+=4) { j = i; <tr> @* I have done this for show 4 images in a Row *@ @while (j < i+4 && j < Model.Count()) { <td> <img src="/Images/@ViewBag.Image" width="100" height="100" /> </td> j++; } </tr> } } </table>
string query1 = "select ImageName from FileUploads Where UserId='"+User.UserId+"'"; SqlCommand cmd = new SqlCommand(query1, con); cmd.CommandType = CommandType.Text; con.Open(); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { string name = dr["ImageName"].ToString(); // string city = dr["City"].ToString(); //Response.Write("Name: " + name); foreach (var img in name) { ViewBag.Image = name; //s Response.Write(img); } } con.Close();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)