Accessing an image on the web form
-
I know it's pretty basic. I have some image controls on a page. User will upload the images and the images will show up in the image controls as they are uploaded (there is a max number they can upload). I was trying to access them to see if imageurl is empty - so I can take the first control to put the image, then the second one and so on. But it's not working. Here's what I am trying:
foreach (System.Web.UI.WebControls.WebControl webctrl in this.Controls) { if (typeof(webctrl) is Image) { if (webctrl.ImageUrl.Equals("") == false) { ++count; } else { img.Visible = false; } } }
Any idea? Thanks. -
I know it's pretty basic. I have some image controls on a page. User will upload the images and the images will show up in the image controls as they are uploaded (there is a max number they can upload). I was trying to access them to see if imageurl is empty - so I can take the first control to put the image, then the second one and so on. But it's not working. Here's what I am trying:
foreach (System.Web.UI.WebControls.WebControl webctrl in this.Controls) { if (typeof(webctrl) is Image) { if (webctrl.ImageUrl.Equals("") == false) { ++count; } else { img.Visible = false; } } }
Any idea? Thanks.