![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I get this design-time error (below) when setting thus property in my inherited web control to 'True'. I've debugged the code running at design-time to double check to see that no exception was being thrown. While there are other people that have run into this exception, what I've found so far hasn't been helpful. What is the proper way to declare custom Boolean properties that need to be persisted in attributes through the Web Forms designer? Paul There was an error rendering the control. 'True' could not be set on property 'ShowEmptySelection'. DefaultValue(False), _ DesignerSerializationVisibility(DesignerSerializat ionVisibility.Visible), _ PersistenceMode(PersistenceMode.Attribute), _ Bindable(True), Category("Appearance")> _ Public Overridable Property ShowEmptySelection() As Boolean Get Dim ret As Boolean = False Dim o As Object = Me.ViewState("ShowEmptySelection") If Not o Is Nothing Then ret = CBool(o) End If Return ret End Get Set(ByVal value As Boolean) Me.ViewState("ShowEmptySelection") = value End Set End Property |
#3
| |||
| |||
|
|
But that will make the property always return true if there is a value in view state, regardless of the actual value. |
#4
| |||
| |||
|
|
"Göran Andersson" <guffa (AT) guffa (DOT) com> wrote in message news:uquKVbkCIHA.1056 (AT) TK2MSFTNGP03 (DOT) phx.gbl... But that will make the property always return true if there is a value in view state, regardless of the actual value. It seems like that's what the OP wants here since all he was doing in his original code was casting the value to a Boolean. Wouldn't any value cause the cast to result in True, but no value would cause False? |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |