473,765 Members | 2,097 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 2515
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
10073
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
4493
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
1418
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
1321
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
6250
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
5425
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
1186
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
2761
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
1867
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
9566
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
10007
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...
0
9832
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8830
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...
0
5272
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...
0
5413
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3921
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
3530
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2800
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.