473,325 Members | 2,308 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

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

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
2 2482
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Shawn Wildermuth | last post by:
I have a *single* SqlDataSource that loads up a single result set that I show in a GridView. In the GridView, i've added a "Select" button and handling the SelectedItem event. I also have a...
4
by: P. Yanzick | last post by:
Hello, I've been playing with master/detail views as well as editing in the gridview, and I ran across a strange problem that I am not exactly sure where to go to try to solve. I have 2...
1
by: needin4mation | last post by:
Hi, I have a gridview and a detailsview. Is it possible to select a row in the gridview, not have a postback, and instead have a detailsview populate based upon the gridview - in Atlas, no...
0
by: loga123 | last post by:
Hi All, I have a requirement where I am using Gridview to display list of categories. When they click on a category, it opens a "detailsview" displaying the first four items that come under...
2
by: nolan | last post by:
I have an asp.net 2.0 page with a gridview and detailsview on the same page set up in a master-details scenario. The gridview and detailsview have separate SQL data sources. The user enters...
7
by: studio60podcast | last post by:
I have a gridview and a details view in a page. The two are hooked up, so that when a row is selected in the GridView, the DetailsView displays the details. But, what I'm trying to accomplish is...
4
by: rn5a | last post by:
Please have a look at this URL (it won't take even 5 seconds to download): http://rn5a.brinkster.net/Page1.html I want a DataGrid to render itself like the HTML table shown in the above URL....
3
by: =?Utf-8?B?QW5nZWw=?= | last post by:
I seem to understand how the control works as long as I mated to SqlDataSource or ObjDataSource it works fine. But I do not want to flatten my design in this manner. I am interested in how I can...
0
by: | last post by:
I'm using a detailsview to insert a record, should be simple enough? What am I doing wrong? Thank you for your help. The user fills in all the textboxes and hits insert. I've tried every event...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.