Hi,
I tried this with both Image and HtmlImage but the image just doesn't display.
protected void Page_Load(object sender, EventArgs e)
{
WebPartManager wpManager = WebPartManager.GetCurrentWebPartManager(this);
...
HtmlImage img = new HtmlImage();
img.Src = ResolveUrl("~/Images/Dilbert.gif");
img.ID = "Dilbert";
img.Attributes["title"] = "Dilbert";
wpManager.AddWebPart(wpManager.CreateWebPart(img), PageWPZone, 1);
}
When I view source in the browser, I find that the src attribute of the img is empty. This doesn't happen if I drag and drop the image in the web part zone in VWD. It only happens if I programmatically add images to the zone.
Any help is appreciated. Thanks =)
I tried this with both Image and HtmlImage but the image just doesn't display.
protected void Page_Load(object sender, EventArgs e)
{
WebPartManager wpManager = WebPartManager.GetCurrentWebPartManager(this);
...
HtmlImage img = new HtmlImage();
img.Src = ResolveUrl("~/Images/Dilbert.gif");
img.ID = "Dilbert";
img.Attributes["title"] = "Dilbert";
wpManager.AddWebPart(wpManager.CreateWebPart(img), PageWPZone, 1);
}
When I view source in the browser, I find that the src attribute of the img is empty. This doesn't happen if I drag and drop the image in the web part zone in VWD. It only happens if I programmatically add images to the zone.
Any help is appreciated. Thanks =)