Last post Mar 12, 2008 05:19 PM by mebinici
Mar 12, 2008 03:35 PM|mebinici|LINK
Hi all, I am a little confused how this should/will work? I have a custom control that has a property similar to the anchor control, which will have a Target property (_self, _blank, ect) now this is my code:
Public Enum TargetModes
_blank = 0
_parent = 1
_self = 2
_top = 3
<Category("Behavior"), DefaultValue(TargetModes._self), Description("Target mode")> _
Shadows Property Target() As TargetModes
Dim _Target As String = CStr(ViewState("Target"))
If _Target Is Nothing Then
Return CType(_Target, TargetModes)
Set(ByVal value As TargetModes)
ViewState("Target") = value
Should I be setting this property as TargetModes? I want the Web Form Designer to be able to enum through the values, but in the code behind I want to just be able to set the value as a string i.e. "_self"
Thanks for your help.
Mar 12, 2008 04:31 PM|Peter Bucher|LINK
You could do this that way or the other way.
But assignments to the property cannot be different in Codebehind and ASPX Code.
Why not set the enum value in Codebehind?
I would prefer that.
If you want both ways, you can write down two propertys,
and assign the right one in a kind of priority match.
Best Regards, Peter
Mar 12, 2008 05:19 PM|mebinici|LINK
I understand the limitations, oh well, I went with the second method and just created two properties named similiar in order to assign the property as a string in the vb codebehind and see the selection options in the web designer.