I have an issue with ashx handler for showing image when i defined HTMl image in code behind. IF i define in ascx, the image is pulled fine but not if i define in .cs.
This is the way i
HtmlImage img1 = new HtmlImage();
img1.Src = "imageout.ashx?PageID=" + PageID.ToString() + "&DIImageID=" + DIImageID.ToString();
In the place of the image, it displays the text of src "imageout.ashx?......."
What is it i am missing here? Help me out.
Thanks in advance
Try
img1.Attributes["src"] = "imageout.ashx?PageID=" + PageID.ToString() + "&DIImageID=" + DIImageID.ToString();
This works for me.