I have the following code in a C # aspx page:
<ItemTemplate>
<a <% if(((Dictionary<string, string>)Container.DataItem)["type"]==Session["type"]){%> class="active"<%}%>
This code causes the following error.
Compiler Error Message: CS0117: 'System.ComponentModel.Container' does not contain a definition for 'DataItem'
Why is this and how can I make a conditional statement that uses Container.DataItem? Container.DataItemworks fine if used in <%# %>, however including the operator ifin <%# %>causes the following error:
Compiler Error Message: CS1518: Expected class, delegate, enum, interface, or struct
source
share