views:

96

answers:

0

Hi

After I call RenderControl on a HtmlImage, the src property gets wiped

e.g.

public class Class1
    {
        public static void Main(string[] args)
        {
            HtmlImage img = new HtmlImage();
            img.Src = "/google.com/image.jpg";
            img.Width = 40;
            img.Height = 40;

            RenderImage(img);
        }

        public static string RenderImage(HtmlImage imageToRender)
        {
            if (imageToRender == null)
            {
                return string.Empty;
            }

            StringBuilder sb = new StringBuilder();
            StringWriter tw = new StringWriter(sb);
            HtmlTextWriter hw = new HtmlTextWriter(tw);

             //set break point before and after this line and inspect src property of imageToRender
            imageToRender.RenderControl(hw);
            return sb.ToString();
        }
    }

This can't be the expected behaviour can it?

Set a breakpoint before and after RenderControl is called and check the SRC property of imageToRender

is there a way to prevent this or am I doing something wrong?

thanks