In the above declaration, I have set up some Template Fields columns so that GridView will automatically generate a row of DropDownLists when a new row is being added.You would also notice that I have added a Button Control under the FooterTemplate at the last column in the GridView.
A method that adds a new row to the GridView when a Button is clicked and store the newly added row values in the Original Table that was defined in the SetInitialRow() method. SetPreviousData(). A method that retains all the items that was selected from the DropDownList when it postbacks.
of new records to the database from the footer row of the GridView control.
(DropDownList)grvStudentDetails.Rows[rowIndex].Cells.FindControl("drpQualification"); drCurrentRow = dtCurrentTable.NewRow()
DropDownList ddl1 = (DropDownList)Gridview1.Rows[rowIndex].Cells.FindControl("DropDownList1")
The idea is once you click on the Add Button the new grid with dropdownlist columns will show up, from there you can save the selected item to your database.
You can post code of how to add new record in gridview also.
I used the GridView_RowDataBound event to populate the DropDownList. Take a look at the method below
The following program shows how to add a blank row between gridview rows. Database.
Home » Dotnet » ASP.NET » Use DropDownList in ASP.NET GridView Control.