在GridView中,我添加了一个GridView自带的ImageField控件,也已经把它的DataImageUrlField绑定在ImageUrl字段上,但就是显示不出图片的内容,我在HTML中测试过,ImageUrl的图片路径是正确的,可以显示出图片。后来我把该字段转化为模板字段,用Image控件来绑定,也还是显示不出图片来。我测试了一天,没查出错在哪?
解决方案 »
- sql2005无法导入的问题,大奖帮我看看?真的没有分了
- 求基于Web的报表解决方案
- 。。
- asp.net 动态生成htm页
- *****************无法打开aspx页面,急啊!!!!!!!!!********************
- 计算数学表达式在线急等,请各位帮帮忙!!!
- 请教使用XML的解决方案
- RegisterStartupScript如何执行
- MVC3 razer页面中DropDownListFor无法选中问题,求帮助
- 请问怎样获得NetworkStream流的长度?(急)
- iis 如何修改浏览器类型,比如我想用firefox或者ie6.0
- 请问如何利用多个dropdownlist进行筛选
HttpPostedFile postFile = this.smallphoto.PostedFile;
string smallname = smallphoto.FileName.ToString();
string type1 = smallphoto.PostedFile.ContentType.ToString();
string type2 = smallname.Substring(smallname.LastIndexOf(".") + 1);
string strFileName = smallname;
string size = smallphoto.PostedFile.ContentLength.ToString();
string timefile = DateTime.Now.ToString("yyMMddHHmmss");
string smallSavePath = Server.MapPath("~\\Products\\" + timefile + "small" + smallname);然后,在ImageField控件中的DataImageUrlField属性中绑定ImageUrl字段,其字段正是储存上述程序中变量smallSavePath中的值。
我在数据库里把其值粘贴在Html 里面的<img>里面的src中,发现能正确显示图片,没任何问题。这是为什么呢?
~/是根目录..这样就不会错了.
就不要在路径前面加~