By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,386 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

Problem with DataBinder.Eval

P: n/a
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
May 30 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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

On May 30, 4:24 pm, "atr2000" <jkahdfjkh...@jkhaefjkhasdkjfh.com>
wrote:
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

May 31 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.