473,396 Members | 1,858 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,396 software developers and data experts.

GridView and DropDownList

I have to display a table with customer data (GridView). However, I want to
be able to show DropDownList controls inside one of the columns, not just
textbox controls. Is this possible? Is it possible to have all of the
controls active so that a simple click of the Submit button updates all
customer records with the data in those DropDownLists?

I was able to do this with classic ASP, but with a GridView control (perhaps
I need a different structure?), I can only edit one record at a time, and I
can only seem to get textboxes in the table, not DropDownLists.

If possible, I need the DropDownList to fill with data from a data source as
well. Thanks for any help.

-Brian
May 8 '07 #1
3 13965
Hi,

by using TemplateFields, you can put anything you want on a GridView row.
For example:

DropDownList inside a GridView (or DataGrid)
http://webthingsconsidered.blogspot....idview-or.html

shows how to populate a DropDownList on the row.

Basically if you update all rows, you'd iterate through the GridView at
Button's Click and update it to the database to by row. I've explained the
idea at simple level:

Understanding the naming container hierarchy of ASP.NET databound controls
http://aspadvice.com/blogs/joteke/ar...-controls.aspx
--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

"Brian VanDyke" <br****@community.nospamwrote in message
news:eq**************@TK2MSFTNGP05.phx.gbl...
>I have to display a table with customer data (GridView). However, I want to
be able to show DropDownList controls inside one of the columns, not just
textbox controls. Is this possible? Is it possible to have all of the
controls active so that a simple click of the Submit button updates all
customer records with the data in those DropDownLists?

I was able to do this with classic ASP, but with a GridView control
(perhaps I need a different structure?), I can only edit one record at a
time, and I can only seem to get textboxes in the table, not
DropDownLists.

If possible, I need the DropDownList to fill with data from a data source
as well. Thanks for any help.

-Brian
May 8 '07 #2
Hi Brian,

As Teemu said, you could use a TemplateField to use whatever controls
inside it. You can find some examples here:

#Using TemplateFields in the GridView Control
http://www.asp.net/learn/dataaccess/....aspx?tabid=63
(There's also many useful ASP.NET 2.0 Data Tutorials here:
http://www.asp.net/learn/dataaccess/....aspx?tabid=63)

Is it possible to have all of the controls active so that a simple click
of the Submit button updates all customer records with the data in those
DropDownLists?
I'm not sure if I fully understand your above question. Do you mean put all
rows of a GridView in edit mode and update them in a batch? If this is the
case, then you may find following example useful:

#Matt Dotson's .NET Tips & Tricks : Real World GridView: Bulk Editing
http://blogs.msdn.com/mattdotson/articles/490868.aspx
Hope this helps.
Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
May 9 '07 #3
Hi Brian,

Have you seen above replies? Would you please reply here to let us know the
status of this post? Thanks.
Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

May 14 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: mateo | last post by:
Hello, I have a GridView inside which i want to show 3 dropdownList (one for each Column). So i've created 3 TemplateField Continent Country City
1
by: CorporateCoder | last post by:
Hi, I am trying to bind the selected value of a databound dropdown box in a databound gridview control to the value being displayed in the template column the dropdown box has been added to. ...
0
by: Ben | last post by:
Hi, It's about a database containing (for simplifying) three fields: 'placenr' (primary key), 'place' and 'color'. The records are updatable (Edit/Update button) in a gridview. For updating the...
5
by: maurban | last post by:
Hi there experts, I have a gridview with a couple textboxes and a dropdownlist. I'm trying to insert a default value into my database driven dropdownlist. I'm doing this in the rowdatabound...
3
by: Jon Paal | last post by:
this text keeps showing up in my gridview dropdownlist "System.Data.DataRowView" How do I prevent this problem ?
5
by: Andrew Robinson | last post by:
I am attempting to better automate a Pager Template within a GridView. I am succesfully skinning a Drop Down List withing my control (the DDL is added to my control). I correctly populate the item...
0
by: lamolap | last post by:
i have 1 gridview , a dropdownlist inside a gridview and a commandfield of (edit, update and cancel) my gidview looks like this Edit Surname Initials ...
0
parshupooja
by: parshupooja | last post by:
Hi all, I need help. I am using asp.net C# . I have binded gridview with 5 columns. I have Dropdownlist in 4 columns Morning in, morning out, afternoon in and afternoon out and label in 5 column...
1
by: Limno | last post by:
Hi, Can anyone suggestion me, how to add dropdownlist in gridview while edit particular record. when i click edit command in gridview, it should display its dropdownlist with DB field Values from...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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,...

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.