473,721 Members | 1,818 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2511
You can use Templates for the DetailsView to specify different controls for
display and editing.

"bogdan" <bo****@nospam. comwrote in message
news:e0******** ******@TK2MSFTN GP04.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.br oadwayData.comw rote in message
news:uH******** ******@TK2MSFTN GP06.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******** ******@TK2MSFTN GP04.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
10071
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 DetailsView (though FormView has this same issue) where I want to be able to set the current item to bind to from the DataSource. All the examples I've seen use two data sources and on every *select* they do another round-trip to the Database (which...
4
4491
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 tables, a table of cars (pretty basic, an ID, a description, and a Color ID) and a table of colors (Color ID, and a color description). I've added a gridview and a detailsview as I'm playing with both and how to get editing features to work the way I...
1
1414
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 postbacks? Thanks.
0
1319
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 that category. I have INSERT enabled on my Detailsview. When user wants to insert another category, it opens Detailsview in insert mode and user is able to enter values
2
6247
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 search criteria in a text box and clicks a find button to initially populate the gridview with items of interest. I have added a select button to my gridview and when the user clicks the button the detailsview is populated perfectly. However, I also...
7
5423
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 this: I have two tables - user and item. user table: user_id int user_name varchar(50) item table:
4
1183
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. How do I do it? Note that the text under the second column are actually retrieved from a MS-Access database table.
3
2759
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 programmatically manipulate the control. In other words maybe just use the data source then extract from the control the information do with it as I see fit. The opposite is also true. I want to be able to add or modify the data in the...
0
1866
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 there is to retrieve cells and rows and I've even converted some of the fields from bound controls to templates, and all the data is blank no matter what I do: <asp:DetailsView ID="dvBillingServiceInsert" runat="server" GridLines="None"
0
8834
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8727
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9212
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9127
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8002
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6664
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4483
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3186
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2569
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.