Is it possible to expose POCO types as public properties with Widget user controls?
I have a widget where I want to display 3 featured items. The content will be kept in the CMS, so I'd like to keep them as public properties that users can edit. Right now I have it as:
public
string
FeaturedBootStyle1
get
;
set
;
public
string
FeaturedBootStyle2
get
;
set
;
public
string
FeaturedBootStyle3
get
;
set
;
public
Guid FeaturedBootStyle1ImageId
get
;
set
;
public
Guid FeaturedBootStyle2ImageId
get
;
set
;
public
Guid FeaturedBootStyle3ImageId
get
;
set
;
public
string
FeaturedBootStyle1Headline
get
;
set
;
public
string
FeaturedBootStyle2Headline
get
;
set
;
public
string
FeaturedBootStyle3Headline
get
;
set
;
public
string
FeaturedBootStyle1Copy
get
;
set
;
public
string
FeaturedBootStyle2Copy
get
;
set
;
public
string
FeaturedBootStyle3Copy
get
;
set
;
public
class
FeaturedBoot
public
string
StyleNumber
get
;
set
;
public
string
Headline
get
;
set
;
public
string
Copy
get
;
set
;
public
Guid ImageId
get
;
set
;
public
FeaturedBoot Boot1
get
;
set
;
public
FeaturedBoot Boot2
get
;
set
;
public
FeaturedBoot Boot3
get
;
set
;
public
FeaturedBoot[] FeaturedBoots
get
;
set
;
I discovered that if you override ToString() method in the POCO, that SiteFinity will set the property in the javascript using the ToString() output.
Hi,
To serialize our object to JSON using the DataContractJsonSerializer we must either mark it with the Serializable attribute or the DataContract attribute. If we mark the class with the DataContract attribute, then we must mark each property we want serialized with the DataMember attribute.
[Serializable]
public class Person
public Person()
public Person(string firstname, string lastname)
this.FirstName = firstname;
this.LastName = lastname;
public string FirstName get; set;
public string LastName get; set;
/// Marked with the DataContact Attribute
[DataContract]
public class Person
public Person()
public Person(string firstname, string lastname)
this.FirstName = firstname;
this.LastName = lastname;
[DataMember]
public string FirstName get; set;
[DataMember]
public string LastName get; set;
Greetings,
Stanislav: