Hello,
I have a user control that has a property StartYear. Logically enough,
this takes an Int32 value. I have no problem doing something like ...
<ctls:fred id="frdFred" StartYear="2000" Runat="Server" />
but if I try ...
<ctls:fred id="frdFred" StartYear='<%=DateTime.Now.Year%>'
Runat="Server" />
I get an error "Cannot create an object of type System.Int32 from its
string representation '<%=DateTime.Now.Year%>' for the StartYear
property".
I tried converting it like this ...
<ctls:fred id="frdFred"
StartYear='<%=Convert.ToInt32(DateTime.Now.Year)%> ' Runat="Server" />
but got the same error.
Any ideas how I get around this? I thought DateTime.Now.Year returned an
Int32, so I have no idea why it thinks it's a string.
TIA
--
Alan Silver
(anything added below this line is nothing to do with me)