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

Posted on 2005-03-12
Medium Priority
Last Modified: 2012-05-05
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
Question by:vinny45
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
LVL 18

Accepted Solution

testn earned 2000 total points
ID: 13527198
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"] %>

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question