Checking that year is jumping using C #

I am very new to C #, so my question may be silly, but I cannot solve it myself and googling. I need to check if the year is a jump, so:

<mso:if runat=server condition='<%# DateTime.IsLeapYear(2000)%>'> 

works great. But I need to get a year from something, for example. MS SQL:

  YEAR(getDate()) AS yarr 

...

 <mso:if runat=server condition='<%# DateTime.IsLeapYear(<%#Convert.ToInt32(DataBinder.Eval(Container.DataItem, "yarr"))%>)%>'> 

Error:

CS1040: Preprocessor directives should appear as the first non-blank character in a string

But why? Do not look at the space before the year.

+5
source share
1 answer

You used the scriptlet <%# %> twice, which is nested, delete it.

 condition='<%# DateTime.IsLeapYear(Convert.ToInt32(DataBinder.Eval(Container.DataItem, "yarr")))%>' 
+8
source

Source: https://habr.com/ru/post/1243913/


All Articles