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
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