By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,201 Members | 922 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,201 IT Pros & Developers. It's quick & easy.

Enumerated type in a custom control tag

P: n/a
Hello all,

Can anyone please tell me why I can't do this (and what I can do to
get the equivalent effect):

In the code:

public enum myenum
value1
value2
end enum

In the aspx page:

<my:customcontrol runat='server' id='mycontrol' customvalue='<
%=myenum.value1%>' />

Thanks,

rts
Jul 25 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Jul 25, 1:20*pm, Rex the Strange <roger.m...@widgetinc.comwrote:
Hello all,

Can anyone please tell me why I can't do this (and what I can do to
get the equivalent effect):

In the code:

public enum myenum
* value1
* value2
end enum

In the aspx page:

<my:customcontrol runat='server' id='mycontrol' customvalue='<
%=myenum.value1%>' />

Thanks,

rts
Never mind. I figured it out. Use:

<my:customcontrol runat='server' id='mycontrol' customvalue='<% eval
(myenum.value1) %>' />

Also, name sure you have an imports tag importing the required
namespace (in my case):

<%@ import namespace='local.library' %>

I hope that helps someone.

rex
Jul 25 '08 #2

P: n/a
On Jul 25, 1:30*pm, Rex the Strange <roger.m...@widgetinc.comwrote:
On Jul 25, 1:20*pm, Rex the Strange <roger.m...@widgetinc.comwrote:


Hello all,
Can anyone please tell me why I can't do this (and what I can do to
get the equivalent effect):
In the code:
public enum myenum
* value1
* value2
end enum
In the aspx page:
<my:customcontrol runat='server' id='mycontrol' customvalue='<
%=myenum.value1%>' />
Thanks,
rts

Never mind. I figured it out. Use:

<my:customcontrol runat='server' id='mycontrol' customvalue='<% eval
(myenum.value1) %>' />

Also, name sure you have an imports tag importing the required
namespace (in my case):

<%@ import namespace='local.library' %>

I hope that helps someone.

rex- Hide quoted text -

- Show quoted text -
Nope. That doesn't seem to work. The property is never being set. Any
ideas anyone?
Jul 25 '08 #3

P: n/a
I've used custom enum values for parameters in custom controls, although
I reference the name of the enum type directly. If you're setting an attribute
on the control in page, make sure you have a control property defined as
being of the particular Enum Type and then reference the type directly.

I have a textbox control that has several settings, a property called Type
that expects a custom Type Enum. So in the attributes I have type="All" where
All is one of the enum values...

Class DateTextBox
Enum DateTypeEnum
All = 1
Future = 2
Past = 4
End Enum

Public Property Type() As DateTypeEnum
...
End Property

....
End Class

On page:
<ocs:DateTextBox ... Type="All" ... />

This probably isn't exactly what you're looking for, but I hope it helps...
Hello Rex,
On Jul 25, 1:30 pm, Rex the Strange <roger.m...@widgetinc.comwrote:
>On Jul 25, 1:20 pm, Rex the Strange <roger.m...@widgetinc.comwrote:
>>Hello all,

Can anyone please tell me why I can't do this (and what I can do to
get the equivalent effect):

In the code:

public enum myenum
value1
value2
end enum
In the aspx page:

<my:customcontrol runat='server' id='mycontrol' customvalue='<
%=myenum.value1%>' />

Thanks,

rts
Never mind. I figured it out. Use:

<my:customcontrol runat='server' id='mycontrol' customvalue='<% eval
(myenum.value1) %>' />

Also, name sure you have an imports tag importing the required
namespace (in my case):

<%@ import namespace='local.library' %>

I hope that helps someone.

rex- Hide quoted text -

- Show quoted text -
Nope. That doesn't seem to work. The property is never being set. Any
ideas anyone?

Jul 25 '08 #4

P: n/a
On Jul 25, 4:20*pm, The Colorado Kid <tckwrote:
I've used custom enum values for parameters in custom controls, although
I reference the name of the enum type directly. If you're setting an attribute
on the control in page, make sure you have a control property defined as
being of the particular Enum Type and then reference the type directly.

I have a textbox control that has several settings, a property called Type
that expects a custom Type Enum. So in the attributes I have type="All"where
All is one of the enum values...

Class DateTextBox
* Enum DateTypeEnum
* * All = 1
* * Future = 2
* * Past = 4
* End Enum

* Public Property Type() As DateTypeEnum
* * ...
* End Property

* ....
End Class

On page:
<ocs:DateTextBox ... Type="All" ... />

This probably isn't exactly what you're looking for, but I hope it helps....

Hello Rex,
On Jul 25, 1:30 pm, Rex the Strange <roger.m...@widgetinc.comwrote:
On Jul 25, 1:20 pm, Rex the Strange <roger.m...@widgetinc.comwrote:
>Hello all,
>Can anyone please tell me why I can't do this (and what I can do to
get the equivalent effect):
>In the code:
>public enum myenum
value1
value2
end enum
In the aspx page:
><my:customcontrol runat='server' id='mycontrol' customvalue='<
%=myenum.value1%>' />
>Thanks,
>rts
Never mind. I figured it out. Use:
<my:customcontrol runat='server' id='mycontrol' customvalue='<% eval
(myenum.value1) %>' />
Also, name sure you have an imports tag importing the required
namespace (in my case):
<%@ import namespace='local.library' %>
I hope that helps someone.
rex- Hide quoted text -
- Show quoted text -
Nope. That doesn't seem to work. The property is never being set. Any
ideas anyone?- Hide quoted text -

- Show quoted text -
Hey Kid,

You have got to be freaking kidding me! I have exactly that
infrastructure but it never occurred to me to just use the item
without the enumeration in dot notation (well, it might have if I were
working in Delphi which doesn't use the dot notation for enumerated
types). I resorted to using the code builder as demonstrated on this
page: http://weblogs.asp.net/infinitiesloo...onBuilder.aspx
which is, really quite cool, but serious overkill for my purposes.

Your way is much better (and allow me to beat my head against the wall
for not trying it - it's so bloody obvious).

rex.
Jul 25 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.