Setting bit flag enum value in aspx file ?

Setting bit flag enum value in aspx file ?

am 02.01.2008 01:16:33 von Moe Sisko

Using dotnet 2.0. Say I have a user control like the following :

public partial class Controls_MyControl : System.Web.UI.UserControl
{
[Flags]
public enum SomeBitFlag
{
OptionA = 0x01,
OptionB = 0x02,
OptionC = 0x04,
}

public SomeBitFlag AllowedOptions { get, set. etc .. }
....
}

Now, on an aspx page, I place an instance of the control, and want to set
"AllowedOptions" :



This doesn't work because the aspx page doesn't like the string : "OptionA |
OptionC".
It's easy enough to set the bitflag value in the aspx.cs file, but is there
a way to make this work in the aspx file ?

I realise I can define combo bitflags like :
OptionsA_And_C = OptionA | OptionC in the SomeBitFlag enum def, but I'd
rather not have to do this, as there may be many combinations.

Is what I am trying to do supported in asp.net ?

Thanks.