Unable to cast object of type 'EPiServer.Url' to type 'System.String'.

Vote:
 

Hi everyone

I'm trying to add an image property to a pagetype in cms7 but I keep getting the error above. 

 

This is how I've added it to the pagetype:

 

[BackingType(typeof(PropertyImageUrl))]
[Display(
Name = "Image",
Description = "Image",
Order = 3)]
public virtual string ImageUrl { get; set; }

 

But all I get is Unable to cast object of type 'EPiServer.Url' to type 'System.String'.   when I try to choose an image. 

 

Anyone that know what might be wrong?

#63294
Nov 14, 2012 15:14
Vote:
 

Change the type of your property from string to EPiServer.Url

#63296
Nov 14, 2012 15:18
Vote:
 

Thanx Johan

 

But everywhere I look, people have used string. How's this possible?

#63298
Nov 14, 2012 15:26
Vote:
 

This has changed in the release of EPiServer 7

#63305
Nov 14, 2012 16:03
Vote:
 

aha, fair enough :)

#63306
Nov 14, 2012 16:04
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.