Problem with DataBinder.Eval

A

atr2000

I am trying to bind data to my GridView from a field that has 2 of the same
Field Names. However I keep getting an error when I try to get that data.
I allowed the GridView to AutoGenerateColumns. The column name that I want
to Bind manually returns with a header of Table1.FieldName. However when I
try to Bind it as that I get the error below.

How do I get data from a field with two of the same field names? Any ideas
as to how to call this data?

============================
My Sample SQL Query:
============================
Select Table1.FieldName, Table2.FieldName From Table1 Left Join Table2 On
Table1.MyID = Table2.MyID

============================
My Sample DataBinder Code:
============================
<%# DataBinder.Eval(Container.DataItem, "Table1.FieldName") %>

============================
Error:
============================
DataBinding: 'System.Data.DataRowView' does not contain a property with the
name 'Table1.FieldName'.



Thanx in Adv,

atr2000
 
J

jonel.rienton

Try this:

Select Table1.FieldName 'FieldName1', Table2.FieldName 'FieldName2'
From Table1 Left Join Table2 On
Table1.MyID = Table2.MyID

and in your code, reference FieldName1 and FieldName2 accordingly
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top