All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
GridView显示服务器图片(保存为图片路径)_[Asp.Net教程]

Writer: 归海一刀 Article type: Programming skills(编程技巧) Time: 2014/1/30 1:28:29 Browse times: 331 Comment times: 0

GridView显示服务器图片(保存为图片路径)_[Asp.Net教程]


Head photo

Go homepage
Upload pictures
Write articles

GridView显示服务器图片(保存为图片路径)_[Asp.Net教程] //前台页面创建显示图片列



’ runat="server" /> (注:后台方法名用来得到服务器中全路径)





或者2:


显示图片


" target="_blank">"
alt="" width="20px" height="20px" />








后台代码:

//获取图片
protected string GetImg(string img)
{
string imgurl = ImageURL + img; 注:ImageURL为服务器保存图片文件夹的路径
return imgurl;
}

public static string ImageURL {
get {
string imageurl = ConfigurationManager.AppSettings["ImageURL"].ToString()+"/";
if (imageurl != null) {
return imageurl;
}
return "";
}
}

或者2(显示的图片点击可链接到对应的图片地址):

public static string GetImagePath()
{
return ConfigurationManager.AppSettings["ImageUrl"].ToString();
}




There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.