Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
private void PopulateImage()
    {
DataTable dt = new DataTable();
 List<ListItem> files = new List<ListItem>();
        foreach (string filePath in filePaths)
        {  

"here i need to display the image one by one from the folder"
}
  

GridView1.DataSource = dt;
GridView1.DataBind();
    }



How to do?
Any help will be appreciated.
Posted

1 solution

 
Share this answer
 
v2
Comments
[no name] 8-Oct-15 4:02am    
i dont want to store in database. jst to display images from folder in aspx page. in 3*3 manner
[no name] 8-Oct-15 4:05am    
alrdy i have a code to display image in gridview. bt it shows images as one by one like a list. i want display as 3 row 3 column

below the code:
string[] filePaths = Directory.GetFiles(Server.MapPath("~/Images/"));
List<ListItem> files = new List<ListItem>();
foreach (string filePath in filePaths)
{
string fileName = Path.GetFileName(filePath);
files.Add(new ListItem(fileName, "~/Images/" + fileName));
}
GridView1.DataSource = files;
GridView1.DataBind();
Animesh Datta 8-Oct-15 4:11am    
as you are using List hence it is showing one by one . what do you mean by 3 row 3 column ?
[no name] 8-Oct-15 5:03am    
am using datatable. if my folder contain 15 images means, it wil display as three pic in a row, and then move to 2nd row, and so on.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900