asp.netimageascxcompiled

Change url images on a user control


I have same compiled user controls (.ascx) and I don't have the code behind. This user controls have some images and the source is defined in code behind. Do you have any idea how I can change the source path images?


Solution

  • The dirty way would be to overwrite the path using jQuery.

    The clean way would be a new Control which implements the original one. Now you should be able to overwrite the original functionality.

    Here's a little example:

        public partial class NewControl : OriginalControl
        {
            protected override void OnInit(EventArgs e)
            {
               base.OnInit(e);
               imageControl.Attribute = "new/path/to/img.jpg";
            }
        }