如何从其他页面上传上传后,在另一页面的网格视图中显示图像
问题描述:
任何人都有关于如何从一个页面上传图片并在网格视图中显示另一个页面的建议加上相同的上传图片有一些其他属性当我们点击它时它会显示这些功能。
Hi,
any one have suggestion about how to upload image from one page and show in another page in grid view plus the same uploaded image have some other property when we click on it it will show these features.
答
以下是我的观点
上传图片页面
- >使用FileUpload控件上传图片文件
- >使用SaveAs方法保存文件FileUpload控件
- >将FilePath(已保存文件的位置)和其他有关上传图像的信息插入数据库表
在GridView页面上
- >从您插入数据的数据库表中检索信息并使用GridView Control进行绑定
- >使用模板列GridView中的图像标记用于显示图像。在img标签的src属性中分配图像路径(但是应该是虚拟路径(如http://localhost/abc.png)而不是物理路径(如C:/abc.png)。
Below is my view to do this
On Upload Image Page
->Use FileUpload control for uploading image file
->Save file using SavesAs method of FileUpload control
->Insert FilePath (where you have saved file) and other information about uploaded image into database table
On GridView Page
->Retrieve information from database table where you inserted data and bind with GridView Control
->Use template column with Image tag in GridView to display image. Assign image path in src attribute of img tag (but is should virtual path(like http://localhost/abc.png) not physical path (like C:/abc.png).