473,406 Members | 2,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Enumerated type in a custom control tag

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
4 2971
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Alastair Cameron | last post by:
I have a VB (VB6, not .NET) application that reads an XML file (using MSXML v3.2 parser); the XML file contains a reference to an external DTD. The DTD has numerous enumerated attribute...
0
by: Martin | last post by:
I am currently writing a program and I am trying to create a property for a custom control that can be set a value of either 'linear' or 'traditional' in the properties window in design time from an...
3
by: | last post by:
For a given web form, I want to know what the +simplest+ way to add an attribute to all of a particular control type on that page. For example, I might want to add an onClick attribute to all...
22
by: Ben Finney | last post by:
Howdy all, I've recently packaged 'enum' in PyPI. In its description, I make the claim that it creates "immutable" enumeration objects, and that the enumeration values are "constant" values. ...
1
by: davidmcb | last post by:
I have defined an enumerated type that I use in various places in my schema. I am in the process of creating a new complex type that contains an attribute that I want to restrict to NOT being a...
4
by: Shawnk | last post by:
This post is intended to verify that true value semantics DO NOT EXIST for the Enum class (relative to boolean operations). If this is true then (thus and therefore) you can not design state...
7
by: John Goche | last post by:
Hello, The following program compiler and runs fine under gcc and produces the output 3. However, I am not sure whether such behavior is legal. In particular, as a related question, how would I...
1
by: senfo | last post by:
I'm using an enumerated type to identify a record type that relates to a unique ID in a database. Identity columns in SQL start at 1, while enumerated types in C# start at 0. I didn't think it...
4
by: Peted | last post by:
Hi i am trying to make a small mdoification to and exisiting dll control, in its source code. Im trying to expose one of its internal properties so the user can set it in the ide at...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.