Wierdness When Passing Properties to User Controls
Hi,
I'm relatively new to User Controls, so forgive me if this is a dumb question.
In passing various properties to a User Control from the main ASPX page, as in the example below...
<aar:SecondNavs runat="server" id="GiveNavs" ActivePage="Donate" Source="Give" />
... I run into situations where sometimes the User Control doesn't "See" one of the properties. Within the User Control I have the Property declared as a Public variable.
In the example above the User Control started out accepting only 1 property: ActivePage. Then I added the second one, Source, by adding another Public variable in the codebehind for the User Control, and adding the Source="Give" line to main page. The User Control did not see the value of "Give" for that property, but instead saw an empty string.
What fixed this was simply changing the order of the properties in the main page, from
<aar:SecondNavs runat="server" id="GiveNavs" ActivePage="Donate" Source="Give" />
to
<aar:SecondNavs runat="server" id="GiveNavs" Source="Give" ActivePage="Donate" />
Then all of a sudden my User Control could "see" the value of "Give" for the Source Property.
Any idea what's up with this? Is this another Visual Studio 2003 failing?
Thanks.
Aaron
|