Tip—Using a DropDownList in a DataGrid
This section was really just an afterthought, but we think you'll enjoy it. Many people have asked us how to put some kind of List control (ex: DropDownList) in a DataGrid or DataList. At first thought you might think it would be difficult because each row in the DataGrid or DataList is generated once for each row in the data source. In actuality it is really quite simple to do. In this example (Listing 10.8) we will demonstrate how to use a DropDownList in a DataGrid. We are going to keep the example very simple, but the technique used is going to work for all other situations and controls. The DataGrid in Listing 10.8 has two columns, one is the Company Name and the other is Products. The Products column ...
Get Programming Data-Driven Web Applications with ASP.NET now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.