Creating a default value for a user control property

Posted by Community Admin on 04-Aug-2018 19:24

Creating a default value for a user control property

All Replies

Posted by Community Admin on 16-Dec-2011 00:00

In Sitefinity 3.x you used to be able to add the [DefaultValue()] Attribute to a property. This doesn't seem to be supported anymore in SF 4 - is there a new way to initialize properties with default values? Should this be done in the control's constructor?

Posted by Community Admin on 21-Dec-2011 00:00

Hello,

I believe a similar code should do the work:

private string _name;
[DefaultValue("James")]
public string Name
    get
   
    return  _name;
   
    set
   
    _name = value;
   


Greetings,
Jen Peleva
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed