我尝试使用组合选择更改加载图像:
通常我可以通过以下方式加载图像:
剃刀视图:
<img id="imgPhotoIcon" src="@Url.Action("GetPhoto", "Contractor", new { id = Model.ContactPersonnelID })" alt="Photo" style="width:150px; height:150px" />
控制器部分:
public Image GetPhoto(int id)
{
ContactPersonnel oContactPersonnel = new ContactPersonnel();
oContactPersonnel = oContactPersonnel.GetWithImage(id, (Guid)Session[SessionInfo.wcfSessionID]);
if (oContactPersonnel.Photo != null)
{
MemoryStream m = new MemoryStream(oContactPersonnel.Photo);
System.Drawing.Image img = System.Drawing.Image.FromStream(m);
img.Save(Response.OutputStream, ImageFormat.Jpeg);
return img;
}
else
{
return null;
}
}
现在我想根据所选项目加载带有组合选择更改的图像,任何人都可以帮助我