My datasource has an Rating
dataItem contains an integer from 0 to 5. I'd like to print stars accordignly.
I'm trying to do it within Repeater
control:
<b>Rating:</b>
<% for (int j = 1; j <= DataBinder.Eval(Container.DataItem, "Rating"); j++)
{ %>
<img src="App_Pics/fullstar.png" />
<% }
for (int j = 1; j <= 5 - DataBinder.Eval(Container.DataItem, "Rating"); j++)
{ %>
<img src="App_Pics/emptystar.png" />
<%} %>
- I get the error
The name 'Container' does not exist in the current context
. It is weird, because when I used<%# DataBinder.Eval(Container.DataItem, "Name")%>
a line before, it worked great. - Is it clever to include loops in my
aspx
page? I think it's not very convenient. What's my alternatives? - What's that
#
means?
Thank you very much.