P
Peter Morris
I have an ASP:Repeater which shows Title, DateCreated, State
In addition I want two extra columns in my table
01: Modify (this works)
02: Publish or Withdraw depending on Item.CanPublish or Item.CanWithdraw
<tr class="DataListStyle">
<td><%# Html.Encode((string)DataBinder.Eval(Container.DataItem,
"Title")) %></td>
<td><%# DataBinder.Eval(Container.DataItem, "DateCreated") %></td>
<td><%# DataBinder.Eval(Container.DataItem, "State") %></td>
<td><a href="/Advert/Modify/<%# Eval("ID") %>">Modify</a></td>
<td>
<% if ((bool)DataBinder.Eval(Container.DataItem, "CanPublish")) { %>
<a href="/Advert/Publish/<%# Eval("ID") %>">Publish</a>
<% } %>
<% if ((bool)DataBinder.Eval(Container.DataItem, "CanWithdraw")) { %>
<a href="/Advert/Withdraw/<%# Eval("ID") %>">Witdraw</a>
<% } %>
</td>
</tr>
ERROR: CS0103: The name 'Container' does not exist in the current context
If instead I use the following
<% if ((bool)Eval("CanPublish")) { %>
I get the error
ERROR: Databinding methods such as Eval(), XPath(), and Bind() can only be
used in the context of a databound control.
So, how do I achieve this?
Thanks
Pete
In addition I want two extra columns in my table
01: Modify (this works)
02: Publish or Withdraw depending on Item.CanPublish or Item.CanWithdraw
<tr class="DataListStyle">
<td><%# Html.Encode((string)DataBinder.Eval(Container.DataItem,
"Title")) %></td>
<td><%# DataBinder.Eval(Container.DataItem, "DateCreated") %></td>
<td><%# DataBinder.Eval(Container.DataItem, "State") %></td>
<td><a href="/Advert/Modify/<%# Eval("ID") %>">Modify</a></td>
<td>
<% if ((bool)DataBinder.Eval(Container.DataItem, "CanPublish")) { %>
<a href="/Advert/Publish/<%# Eval("ID") %>">Publish</a>
<% } %>
<% if ((bool)DataBinder.Eval(Container.DataItem, "CanWithdraw")) { %>
<a href="/Advert/Withdraw/<%# Eval("ID") %>">Witdraw</a>
<% } %>
</td>
</tr>
ERROR: CS0103: The name 'Container' does not exist in the current context
If instead I use the following
<% if ((bool)Eval("CanPublish")) { %>
I get the error
ERROR: Databinding methods such as Eval(), XPath(), and Bind() can only be
used in the context of a databound control.
So, how do I achieve this?
Thanks
Pete