0

Please help me... How to dynamically create image array and display images which is in folder. I tried this one but not displaying image. its simply printing text message that [B]System.Web.UI.WebControls.Image[/B]

 protected void Page_Load(object sender, EventArgs e)
    {
        Image[] image = new Image[25];

        for (int i = 0; i < 5; i++)
        {
            image[i] = new Image();            
            image[i].Height = 100;
            image[i].Width = 75;
            image[i].BorderWidth = 0;
            Response.Write(image[i]);
            image[i].ImageUrl = Server.MapPath("~/1.jpeg");
        }       
    }

Edited by Reverend Jim: Fixed formatting

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by dnanetwork
0
ImageButton[] image = new ImageButton[25];

        for (int i = 0; i < 5; i++)
        {
            image[i] = new ImageButton();
            image[i].Height = 100;
            image[i].Width = 75;
            image[i].BorderWidth = 0;
            image[i].ImageUrl = "~/Images/Danger.png";
            image[i].Visible = true;
            form1.Controls.Add(image[i]);
            form1.Controls.Add(new LiteralControl("<br /><br />"));
        }

Done..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.