Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Setting bit flag enum value in aspx file ?

Reply
Thread Tools

Setting bit flag enum value in aspx file ?

 
 
Moe Sisko
Guest
Posts: n/a
 
      01-02-2008
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" :

<uc:MyControl runat="server" ID="ucMyControl" AllowedOptions="OptionA |
OptionC" />

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.





 
Reply With Quote
 
 
 
 
Flatulus Flatulus is offline
Junior Member
Join Date: Jan 2008
Posts: 2
 
      01-02-2008
Im far from being a ASP .NET expert... but couldn't you just set the value of AllowedOptions in the "page load" event handling function?

Something like:

Code:
protected void Page_load()
{
	...
	ucMyControl.AllowedOptions = SomeBitFlag.OptionA | SomeBitFlag.OptionC;
	...
}
 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the point of having 16 bit colour if a computer monitor can only display 8 bit colour? How do you edit 16 bit colour when you can only see 8 bit? Scotius Digital Photography 6 07-13-2010 03:33 AM
Possible to set a UserControl's bitwise Enum value in aspx file ? Moe Sisko ASP .Net Web Controls 2 01-07-2008 11:39 PM
enum within an enum - Java 6 06-13-2005 12:51 AM
64 bit - Windows Liberty 64bit, Windows Limited Edition 64 Bit, Microsoft SQL Server 2000 Developer Edition 64 Bit, IBM DB2 64 bit - new ! vvcd Computer Support 0 09-17-2004 08:15 PM
64 bit - Windows Liberty 64bit, Windows Limited Edition 64 Bit,Microsoft SQL Server 2000 Developer Edition 64 Bit, IBM DB2 64 bit - new! Ionizer Computer Support 1 01-01-2004 07:27 PM



Advertisments