But how do I do it dynamically? I could define a single template per field
in DetailsView. What I'd like to do is to (I think) have different
templates for the same fields based on some criteria.
For example, I get an 'item' from db. The 'item' has a column called
'content'. The content (which is a text) can represent a filename, a
paragraph of text, or a line of text. It all depends on a value in another
column of the item.
So, if I a filename is selected in the 'parent' GridView I'd like the
DetailsView display a short text box and have a corresponding validator
attached to it. On the other hand, if a paragraph is selected in the
GridView I'd like DetailsView to display a multiline text box and no
validator.
The item's remaining fields and their templates would identical in all
cases.
Thanks,
Bogdan
> You can use Templates for the DetailsView to specify different controls
> for display and editing.
[quoted text clipped - 14 lines]
>>
>> Can this be done? If not, any recommendations for alternative solutions?
Paul Shapiro - 22 Mar 2008 13:01 GMT
You might want to rethink the db design a bit. One field should really have
one meaning, not dependent on the values of other fields, like the meaning
of content depends on content type in this example.
I'm pretty new at asp.net development, so you might get better suggestions
from people with more experience. One possibility for alternate templates
would be to include the same field as many times as you have desired control
types. Then hide all but the appropriate control depending on the content
type.
> But how do I do it dynamically? I could define a single template per
> field in DetailsView. What I'd like to do is to (I think) have different
[quoted text clipped - 34 lines]
>>> Can this be done? If not, any recommendations for alternative
>>> solutions?