Question

I am making a custom ImageButton Control which has the option to show button clicked effect by adding onmouseup and onmousedown javascript code to change image URL. I have constructed the control and it has a ClickImageUrl to set the URL of image to be shown when button is clicked..

i wanted to know is there any way i can add a Select URL dialog box for my control just like the Dialog box for ImageUrl. is it even possible??? and if so how would i go about doing it...??

any help will be much appreciated.

EDIT: based on the answer by Arther i am able to show a Select Image URL diaolog box when i use it to set ClickImageUrl it shows a designer error as :

Error Rendering Control An unhandled exception has occured '~/images/7.jpg' cannot be set on property 'ClickImageUrl'

is it conflicting with the ImageUrl ???

Was it helpful?

Solution

If your talking about the VS Designer, then you have to decorate your Property with these Attributes:

public class CustomImageButton : System.Web.UI.WebControls.ImageButton
{
    [Editor("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
    [UrlProperty]
    public string ClickImageUrl { get; set; }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top