Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Hi!
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.
/Linus
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.
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?
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.
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".
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.
Something like this:
var propertyUrl = new PropertyUrl {Value = ImageLink.Url}; var propertyUrlControl = new Property(propertyUrl) {EditMode = true, ID = "Url"}; // Then on postback ((IPropertyControl)propertyUrlControl.Controls[0]).ApplyChanges(); var value = propertyUrlControl.PropertyValue as string;
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?