By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,882 Members | 2,465 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,882 IT Pros & Developers. It's quick & easy.

Different DetailsView templates for items in a GridView. Is it possible?

P: n/a
Hi,

Can a single GridView be 'connected' to DetailsView that renders itself
differently based on the currently selected row?
I have a GridView with rows that could be displayed in the same way in the
view (like a report) but when a user wants to edit/insert items I'd like to
show a different layout and [possibly] different controls based on the
selected item type. For example, for some items I'd like to provide text
boxes and for others I'd like to provide dropdownlists, extra buttons, etc.

I'd like to have the DetailsView displayed on the same page as the GridView.

Can this be done? If not, any recommendations for alternative solutions?

Thanks,
Bogdan

Mar 21 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You can use Templates for the DetailsView to specify different controls for
display and editing.

"bogdan" <bo****@nospam.comwrote in message
news:e0**************@TK2MSFTNGP04.phx.gbl...
Hi,

Can a single GridView be 'connected' to DetailsView that renders itself
differently based on the currently selected row?
I have a GridView with rows that could be displayed in the same way in the
view (like a report) but when a user wants to edit/insert items I'd like
to show a different layout and [possibly] different controls based on the
selected item type. For example, for some items I'd like to provide text
boxes and for others I'd like to provide dropdownlists, extra buttons,
etc.

I'd like to have the DetailsView displayed on the same page as the
GridView.

Can this be done? If not, any recommendations for alternative solutions?
Mar 21 '08 #2

P: n/a
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

"Paul Shapiro" <pa**@hideme.broadwayData.comwrote in message
news:uH**************@TK2MSFTNGP06.phx.gbl...
You can use Templates for the DetailsView to specify different controls
for display and editing.

"bogdan" <bo****@nospam.comwrote in message
news:e0**************@TK2MSFTNGP04.phx.gbl...
>Hi,

Can a single GridView be 'connected' to DetailsView that renders itself
differently based on the currently selected row?
I have a GridView with rows that could be displayed in the same way in
the view (like a report) but when a user wants to edit/insert items I'd
like to show a different layout and [possibly] different controls based
on the selected item type. For example, for some items I'd like to
provide text boxes and for others I'd like to provide dropdownlists,
extra buttons, etc.

I'd like to have the DetailsView displayed on the same page as the
GridView.

Can this be done? If not, any recommendations for alternative solutions?

Mar 21 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.