ASP.NET C#中的绑定下拉列表 [英] binding drop downlist in asp.net c#

查看:81
本文介绍了ASP.NET C#中的绑定下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在D驱动器中有一个文件夹,其中包含一些图像,我想访问下拉列表上的那些图像ID,当我选择下拉列表值时,必须在gridview上显示相应的图像,任何人都可以帮助我...(不想使用任何数据库来存储图像)


I have a folder in my D drive which contains some images i want to access those image ID''s on dropdownlist and when I select the dropdownlist value the respective image have to be displayed on gridview can any one help me...(I dont want to use any database to store images)

推荐答案

查找所有文件名并将其绑定到下拉列表.


//在文件夹中查找所有文件
Find all the file Names and bind it to dropdown.


//FIND ALL FILES IN FOLDER
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(Location);
foreach (System.IO.FileInfo f in dir.GetFiles("*.*"))
   {
   //LOAD FILES
   ListViewItem lSingleItem = listView1.Items.Add(f.Name);
   //SUB ITEMS
   lSingleItem.SubItems.Add(Convert.ToString(f.Length));
   lSingleItem.SubItems.Add(f.Extension);
   } 




并在显示时显示文件.




and on slection display the file.


这篇关于ASP.NET C#中的绑定下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆