datamap template fields

datamap template fields

Old forum URL: forums.lhotka.net/forums/t/281.aspx


steelwool posted on Monday, June 05, 2006

I can't find a way to have the datamap function map values from a templatefield the way it does from bound fields - how do i do this?

BigRon replied on Tuesday, June 06, 2006

This is a good question for which there does not appear to be an answer to.  Its a disappointing utility and would go so far as to say its "incomplete."  Essentially, for templated fields and other controls such as dropdownlist, we do a .FindControl("id") to then populate/update the biz object.  If I'm missing something... please humble me.

RockfordLhotka replied on Tuesday, June 06, 2006

To be clear, my only goal was to support the new data binding in ASP.NET 2.0, not to build a complete replacement for data binding that would move data into/out of arbitrary controls on a web page. If that is your expectation then it will probably always be "incomplete", because that's not its purpose in my mind.

It is, of course, possible to use data binding and templated fields at the same time - I do this in the PTWeb project. In that case the data binding infrastructure does provide those values and so DataMapper is able to use them. If you look at DataMapper, it is not complex, nor is it intended to be complex. It really is just a mapper from one object into another.

I guess what I'm saying, in short, is that web technologies remain quite immature in some ways, and I view this whole thing as a limitation of data binding in the web more than anything else.

BigRon replied on Monday, June 19, 2006

Rocky,

Thank you for clarifying the capabilities.  I think what would be helpful for the community is to provide some "best practices" for how we should map data from controls into their associated object properties.  For example, I mentioned in my last post that I was using .FindControlById("id") and then accessing the public property of the object with the control value.  Just wondering if there might be a better way to move those values into the object.

Copyright (c) Marimer LLC