HighTechTalks DotNet Forums  

Re: how to set default values for non-basic type properties?

ASP.net Building Controls microsoft.public.dotnet.framework.aspnet.buildingcontrols


Discuss Re: how to set default values for non-basic type properties? in the ASP.net Building Controls forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
John Saunders
 
Posts: n/a

Default Re: how to set default values for non-basic type properties? - 09-21-2003 , 04:22 PM






"Ben Schwehn" <b.schwehn (AT) gmx (DOT) net> wrote

Quote:
Hello everyone.

I need some help with how to set default values for 'complex' properties.

My problem is this:
I have a control with a property CellStyle of type TableItemStyle. I want
to initialise this property with some default values eg.
CellStyle.ForeColor="Gray" etc.

With a basic datatype i would just use the DefaultValueAttribute eg for a
bool I'd add the attribute: [DefaultValue(true)] How can i do this for my
CellStyle property?

My workaround so far is to just inititialise CellStyle in the
contstructor, which works to the extend that the values I set in the
constructor are all displayed in VS, however I would like the IDE to know
that the values are default values (because the IDE adds all values it
thinks are not default to the tag definition in the aspx file eg adds
CellStyle Font-Size="12px" Height="32px" BackColor="#D6D3CE"></CellStyle
to the control tag even though these are the default values).
When you add a DefaultValue attribute to a property, it does not initialize
the property to that value. This attribute simply tells the Property Grid
which value is the default. All non-default values will be displayed in bold
type.
--
John Saunders
Internet Engineer
john.saunders (AT) surfcontrol (DOT) com




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.