Problem with Image controls in ASP.NET
Posted on 2011-09-11
I have a web page that contains images in a Panel control. The images are loaded with a CssStyle of "borders_off".
if (obj.className == 'borders_on')
I have a button on the Page that when clicked I want to look for all images whose ClassName is 'borders_on'. Right now I am just printing the value and the problem is all the images show borders_off even though the images have been clicked. Here is the code:
Dim img As Image
If CurrentPanel.HasControls Then
For Each ctrl As Control In CurrentPanel.Controls
If ctrl.GetType.ToString = "System.Web.UI.WebControls.Image" Then
Label1.Text = Label1.Text & ctrl.ID & ", " & TryCast(ctrl, Image).CssClass & "<br />"
What do I need to do so that the current state of the image control is returned when the image is clicked? Any help is greatly appreciated.