User1947866343 posted
I'm creating a custom web control to display weather from an xml feed. I have a couple questions regarding properties.
1. I have a boolean property called "ShowForecast". If I set the default value to True or False, it always returns false when viewed in the browser. However, if I set the default value to "", it works every time...? I'm curious if
anyone can give me some tips about DefaultValues of properties.
Works:
Private _showForecast AS Boolean
<Category("Appearance"), DefaultValue("")> _
Public Property ShowForecast() As Boolean
Get
Return _showForecast
End Get
Set(ByVal value As Boolean)
_showForecast = value
End Set
End Property
Doesn't work:
Private _showForecast AS Boolean
<Category("Appearance"), DefaultValue(True)> _
Public Property ShowForecast() As Boolean
Get
Return _showForecast
End Get
Set(ByVal value As Boolean)
_showForecast = value
End Set
End Property
2. I have a string property with a default value of "Images". I would like "Images" to appear in the property pane the first time the control is dropped onto an aspx/ascx from the toolbox. No matter what I put in the "DefaultValue" field in my
code, they always show up blank. Any thoughts?