Image picker on page


I would like to put an image picker on a page to let a user pick an image from episerver filesystem, like the "Url to Image" property inside episerver.

How do I go about this?

Mar 25, 2011 10:09


You could use a Property with a backing property of type PropertyFileUrl and set EditMode="true". This would require that you opened up access to some aspx files if the user does not have access to the UI-folder. If this is not possible you need to create your own UI for your image selection and work against the UnifiedFile-API.


Mar 25, 2011 13:13

Im a bit confused on how the code would look like in the first case.
The picker will be used on an extranet page and the user will have access to the ui-folder.

Mar 25, 2011 13:39

Ok, its friday. Had forgotten to set EditMode="true" so now I can pick from the site.

Another question that pops up is how do I get the value of the property in codebehind?

Mar 25, 2011 13:56

If the property resides on the page, just set CurrentPage = CurrentPage.CreateWritableClone() in page init when in edit mode. Then you need to call PrepareForSave in your save handler before actually saving the page.

Mar 25, 2011 14:37

Thanks for the tip but in this case we want to save the selected value to a database and need to extract the value of the "picker".

Mar 25, 2011 14:42

Set the InnerProperty to a writable version of a PropertyUrlControl early in the page cycle. Then you can extract the data from the Value property on your PropertyUrlControl.

Mar 25, 2011 14:56

Something like this:

var propertyUrl = new PropertyUrl {Value = ImageLink.Url};
var propertyUrlControl = new Property(propertyUrl) {EditMode = true, ID = "Url"};

// Then on postback


var value = propertyUrlControl.PropertyValue as string;




Mar 28, 2011 22:26
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.