views:

281

answers:

1

This is a purely theoretical question (at least until I start trying to implement it) but here goes.

I wrote a web form a long time ago which has a configurable section for getting information. Basically for some customers there are no fields, for other customers there are up to 20 fields. I got it working by dynamically creating the fields at just the right time in the page lifecycle and going through a lot of headaches.

2 years later, I need to make some pretty big updates to this web form and there are some nifty new technologies. I've worked with ASP.NET Dynamic Data just a bit and, well, I half-crazed plan just occurred to me:

The Ticket object has a one-to-many relationship to ExtendedField, we'll call that relationship Fields for brevity.

Using that, the idea would be to create a FieldTemplate that dynamically generated the list of fields and displayed it.

The big questions here would probably be:

1) Can a single field template resolve to multiple web controls without breaking things?

2) Can dynamic data handle updating/inserting multiple rows in such a fashion?

3) There was a third question I had a few minutes ago, but coworkers interrupted me and I forgot. So now the third question is: what is the third question?

So basically, does this sound like it could work or am I missing a better/more obvious solution?

A: 

Did you try creating a FieldTemplate that had a "ListView" of all the Fields? (the ListView would use Dynamic Data to determine which FieldTemplate to display for each field.)

I don't see why this would not be possible. Although, "out of the box", you may have to hit "edit" on each row of the new FieldTemplate's ListView to edit the values. It would be like replacing the "Order Details" link in the Orders List, with an inline List of the "Order Details".

Aaron Hoffman
Heh, I probably should have come back and answered my own question. The answer is yes, but it gets a little complicated...
Telos