MyAcc.RunProcForDataReader("Pro_StudentInf_Search", parameters, out Myread);
if (Myread.Read())
{
string dirPath =Server.UrlEncode(HttpContext.Current.Server.MapPath("~/StuPic"));
string filename = Myread["Num"].ToString();
Image1.ImageUrl =Server.UrlDecode(dirPath) +"\\"+ filename + ".jpg";
} 出来的路径为:src="F:\vs2005\VS2005%e9%a1%b9%e7%9b%ae\StuPic\271632588282.jpg"
为什么始终image控件中是个红叉叉呀,郁闷死我了,哪位大哥帮忙呀。
为什么要转成硬盘的里的真实路径呢??
Image1.ImageUrl = "~/StuPic"+"\\" + filename + ".jpg";
路径结果为:
http://localhost:1886/VS2005%e9%a1%b9%e7%9b%ae/StuPic/271632588282.jpg
但还是红叉叉
top: 0px" Width="150px" [color=#FF0000]ImageUrl='<%# Eval("pgimgesurl") %>' />[/color]
应该是:<asp:Image ID="Image1" runat="server" Height="100px" Style="left: 15px; position: relative;
top: 0px" Width="150px" ImageUrl='<%# Eval("pgimgesurl") %>' />
Image1.ImageUrl='<%# Eval("")%>'