The long and Binding Road
I'm looking at approaches that leverage Asp.Net's databinding abilities as an alternative to some object structures that serve almost only for "ease of" data binding.
I had made this happen before, probably with a typo, but had been unable to reproduce it.
I was trying this seemingly logical progression to bind a field that is deep inside:
<%#DataBinder.Eval(Container.DataItem,"ProductProperties")%> Gives DataSet
<%#DataBinder.Eval(Container.DataItem,"ProductProperties.Tables[0].Rows[0]")%> Gives DataRow
<%#DataBinder.Eval(Container.DataItem,"ProductProperties.Tables[0].Rows[0]['Description']")%> Still gives DataRow !? Nice quotes eh?
<%#DataBinder.Eval(Container.DataItem,"ProductProperties.Tables[0].Rows[0][0]")%> Still gives data row.
What gives? ;) I try a the ItemArray
<%#DataBinder.Eval(Container.DataItem,"ProductProperties.Tables[0].Rows[0].ItemArray[0]")%> Gives me the value. So something works, but I don't want to use indexes, the order will change.
<%#DataBinder.Eval(Container.DataItem,"ProductProperties.Tables[0].Rows[0].Item[0]")%> Wishfull thinking, not a property, compile error.
<%#DataBinder.Eval(Container.DataItem,"ProductProperties.Tables[0].Rows[0].[0]")%> Look at that dot! Bad dot, Good dot. It works
The final functional version:
<%#DataBinder.Eval(Container.DataItem,"ProductProperties.Tables[0].Rows[0].['Description']")%>
I guess that the databinder gets confused by the indexer, the extra dot seems to be the hint it needs to realize that the is annother level to look at.