String[] pic_ending = new String[] { ".gif", ".png", ".jpg" }; int rows = quantity/3; if ((quantity % 3) != 0) rows++; int col = 3; int number = 0; for (int r = 0; r < rows; r++) { TableRow myRow = new TableRow(); for (int c = 0; c < col; c++) { if (number == quantity) break; String picture = ""; String[] allFiles = System.IO.Directory.GetFiles(name); foreach (String s in allFiles) { foreach (string p in pic_ending) { if (s.Contains(p)) picture = s; break; } } picture = picture.Replace("C:\\inetpub\\" ,"~/"); picture = picture.Replace("\\", "/"); TableCell myCell = new TableCell(); myCell.Width = System.Web.UI.WebControls.Unit.Percentage(33); myCell.HorizontalAlign = HorizontalAlign.Center; myCell.Controls.Add(new LiteralControl("<asp:Image ID=\"Image" + number + "\" runat=\"server\" src=\"" + picture +"\"" + "/></br>" + distingtDir(name))); myRow.Cells.Add(myCell); number++; } UpperTable.Rows.Add(myRow); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)