Mike:
I don't think you can do it via the DataBinder.Eval function, but you can do
it by casting Container.DataItem to the appropriate type. If you are
binding to a Dataset, DataView or DataTable then it'll be a DataRowView. If
you are binding to an DataReader then it'll be a DbDataRecord
You can learn more about this explicit casting at
http://support.microsoft.com/default...b;en-us;307860
Once you have that, you can do:
<%# ctype(Container.DataItem, DataRowView)(0) %>
or in C#
<%# ((DataRowView)Container.DataItem)[0] %>
switch DataRowView to DbDataRecord if you are binding to a DataReader.
Also, don't forget to add <%@ Import Namespace="System.Data" %> for
DataRowView and <%@ Import Namespace="System.Data.Common" %> for
DbDataRecord...
Hope this helps,
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Mike" <Mi**@discussions.microsoft.com> wrote in message
news:FA**********************************@microsof t.com...
When using a repeater control I want to get the database value by index
instead of using the column name. How can I do this? My current repeater
code
looks like this:
<asp:repeater id="rprtroplinks" runat="server">
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<A href="<%# DataBinder.Eval(Container.DataItem,
"Specimen_Link")%>">Link</A>
<br>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:repeater>