• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 256
  • Last Modified:

don't want to use databinder.eval when binding to repeater

I have a repeater in asp.net/C#. I dont' want to use <%# DataBinder.Eval(Container.DataItem,"Name") %>.

Instead, i want to use
<%# Container.DataItem("Name") %> (what i use in VB.net) but i get an error: System.Web.UI.WebControls.RepeaterItem.DataItem' denotes a 'property' where a 'method' was expected

then I use
<%# Container.DataItem["Name"] %>
 Cannot apply indexing with [] to an expression of type 'object'

what the heck is the right syntax
0
vinny45
Asked:
vinny45
1 Solution
 
testnCommented:
in C#, everything is strongly typed.... so you need to cast before you can use it....
if you bind to dataset, you need to do something like

<%# ((DataRowView)Container.DataItem)["Name"] %>
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now