<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.
From stackoverflow
-
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.
Jronny : What we need actually is to *detect* what the attributes used in the tag are... Guess I should edit my question. =)ChristopheD : I've edited my answerJronny : 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.marc_s : 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 toJronny : That's my problem actually. How can we inspect the UserControl.Attributes? The AttributeCollection does not have a List or Dictionary properties.
0 comments:
Post a Comment