views:

39

answers:

1
<uc1:UsercontrolTest ID="UsercontrolTest" runat="server" Hello="World"/>

You see, Hello is not a property of UsercontrolTest class, but we need to detect and get that attribute. Are we allowed to do that? Thanks.

+2  A: 

Does the following not work?

UsercontrolTest.Attributes("Hello")

EDIT:

UserControl.Attributes : Gets a collection of all attribute name and value pairs declared in the user control tag within the .aspx file.

ChristopheD
What we need actually is to *detect* what the attributes used in the tag are... Guess I should edit my question. =)
Jronny
I've edited my answer
ChristopheD
That is okay when we have the idea what the attributes are set on the tag. In my case, I know that the attribute is Hello, but what if another attribute (which I do not have any idea on what it is) is added? Thanks for the reply, by the way.
Jronny
IF you don't know what the attribute is called, just inspect the list in `UserControl.Attributes` - it will contain the name of the attribute and the value it's set to
marc_s
That's my problem actually. How can we inspect the UserControl.Attributes? The AttributeCollection does not have a List or Dictionary properties.
Jronny