locked
Default Property to a class RRS feed

  • Question

  • User370347305 posted

    Hi, I am a little bit confused with default propety attribute. I was looking a code, they said like this 

    [DefaultProperty("Value")]
       [ToolboxData("<{0}:DateEditBox runat=server></{0}:DateEditBox>")]
       public class DateEditBox : CompositeControl
       {
       }
    What does default property means here ? it means, when I drag and drop this control from the control in Visual Studio, will this default property 
    attribute will a default value ? Can someone clarify me. on this. 
    Source : http://www.codeguru.com/csharp/.net/net_asp/webforms/article.php/c12725
    Sunday, December 11, 2011 8:19 AM

Answers

  • User551462331 posted

    defaultproperty indicates the property of server control which would be selected by default when control is selected in designer of visual studio

    suppose, u create this control... and add reference to it in u r project... now, u drag and drop the control on the designer of u .aspx page

    the Value property of the control will be selected (highlighted) by default in the properties window of visual studio

    hope this helps...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, December 11, 2011 9:09 AM