Syntax for field outside code-behind

I have an interesting question. I have a SQL JOIN with 3 databases with the same field in common, ID.  In the SQL statement, they are referenced as a.ID, b.ID and  c.ID.

 If I call the generic field ID I get an error when I reference it like:  
<%# DataBinder.Eval(Container.DataItem, "ID") %>

Is there a way that I can reference this field??
Who is Participating?
"id" is a sql server reserved word, you are probably running into problems because of this.  The best way to fix this is to alias it

Select as MyID, b.field1, c.field2
from atable
<%# DataBinder.Eval(Container.DataItem, "MyID") %>

If you still get an error, you can know it's not because of reserved words!
in your sql query
select as id1, as id2, c.idas id3 ......

Then you can use id1, id2 and id3 to get the field
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.