I want to add images from folder and list it in dropdown . Like my application has folder name flags containing all the flags images and their country name. how do I add them to dropdown .
See Question&Answers more detail:osI want to add images from folder and list it in dropdown . Like my application has folder name flags containing all the flags images and their country name. how do I add them to dropdown .
See Question&Answers more detail:osTry using the System.IO.Directory.GetFiles
and System.IO.Path.GetFileName
http://msdn.microsoft.com/en-us/library/system.io.directory.getfiles(v=vs.110).aspx
http://msdn.microsoft.com/en-us/library/system.io.path.getfilename(v=vs.110).aspx
Something like (haven't tried it)
// Process the list of files found in the directory.
string [] files = Directory.GetFiles(yourDirectory);
foreach(string file in files) {
string language = Path.GetFileName(file);
ddlFlags.Items.Add(new ListItem(language, file));
}
Next time, improve your question by describing what you have tried so far, then it would be easier to help you.