![]() |
|
|
|||||||
![]() |
ASP Net - Populating Dropdownlist in Formview |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
I am trying to do something which seems (to me) to be very simple, and
yet I can't seem to figure it out. I have a gridview and a formview. When a user clicks "select" in the gridview, the formview opens. The user can then click "insert" or "update" to either create a new row or edit the existing row. This all works fine as long as I only use textboxes and checkboxes in my insertItemTemplate and editItemTemplate. What I would like to do is have one field that is bound to a dropdownlist, which is populated when the user clicks update or insert. The problems is: I can't figure out how to access the dropdownlist to get it populated. In all the events I've tried, using FindControl on the formview yields controls like ChildTable, FormViewRow, etc., but no dropdownlists. This has to be a common problem, yet none of my searches yields a working example. Thanks for any insight. Phil Phil Sandler |
|
|
|
|
#2 |
|
Posts: n/a
|
You'll need to create a templatefield/column first, then manually put a
dropdownlist there, yourself. The link to the following sample uses a DetailsView, but the process is the same: http://aspnet101.com/aspnet101/aspne...x?code=dvddlmd -- David Wier MVP/ASPInsider http://aspnet101.com http://aspexpress.com "Phil Sandler" <> wrote in message news: oups.com... > I am trying to do something which seems (to me) to be very simple, and > yet I can't seem to figure it out. > > I have a gridview and a formview. When a user clicks "select" in the > gridview, the formview opens. The user can then click "insert" or > "update" to either create a new row or edit the existing row. > > This all works fine as long as I only use textboxes and checkboxes in > my insertItemTemplate and editItemTemplate. What I would like to do is > have one field that is bound to a dropdownlist, which is populated when > the user clicks update or insert. > > The problems is: I can't figure out how to access the dropdownlist to > get it populated. In all the events I've tried, using FindControl on > the formview yields controls like ChildTable, FormViewRow, etc., but no > dropdownlists. > > This has to be a common problem, yet none of my searches yields a > working example. > > Thanks for any insight. > > Phil > David Wier |
|
|
|
#3 |
|
Posts: n/a
|
David Wier wrote:
> You'll need to create a templatefield/column first, then manually put a > dropdownlist there, yourself. The link to the following sample uses a > DetailsView, but the process is the same: > http://aspnet101.com/aspnet101/aspne...x?code=dvddlmd Thanks for your reply. This is not exactly what I'm trying to do. I want to find the control in a formview event and populate it via a custom method that creates a datatable. This link looks like it uses an objectdatasource for populating the DDL. The main problem I'm having is that I can't seem to use FindControl to get to the ddl. Thanks, Phil Phil Sandler |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Custom control dropdownlist - need advice | tcstom | Software | 0 | 04-18-2008 11:28 AM |
| populating data from sql server to pdf using asp.net | gijichacko | Software | 0 | 08-10-2007 12:31 PM |
| dynamic validations for checkboxlist and dropdownlist | mrugesh_dulera | Software | 0 | 06-26-2007 01:56 AM |
| DropdownList in gridview | visj4u | Software | 0 | 04-27-2007 01:11 PM |
| Formview with ObjectDataSource | rturner003 | Software | 0 | 10-26-2006 12:26 PM |