"Wannabe" <Wannabe@discussions.microsoft.comwrote in message
news:988D8D1A-5A71-4293-8A6D-9D8A92EBF205@microsoft.com...
Quote:
public enum Panes
{
AccountSetup,
ProgramManagement,
CampaignManagement,
ProgramAccounting,
Partners,
MemberMangement,
SysAdmin
}
>
Accordion1.SelectedIndex = Panes.AccountSetup;
>
In the example above, you have to cast Panes.AccountSetup to an int so
Accordion1.SelectedIndex will accept it. I will be using this a lot and
would
Quote:
like to be able to do this without having to cast it everytime I use it.
Is
Quote:
there a way to set up a get accessor (a generic or anything) to cast it
for
Quote:
me? I want to be able to still type it like an enum to keep it readable.
>
I don't have the AJAX Controls so I can't check so see is Accordion is
sealed. If not the you could inherit Accordion control like:-
class MyAccordian : Accordion
{
// Replicate constructors you need here
public new Panes SelectedIndex
{
get { return base.SelectedIndex; }
set { base.SelectedIndex = (int)value; }
}
}
personally I think thats more trouble than its worth.
Sadly you can't add other other members to an enum, it would be nice to be
able to choose to add a implicit operator int to an enum.
--
Anthony Jones - MVP ASP/ASP.NET