Click here to Skip to main content
15,911,711 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I Have a Webform in which gridview is placed and in this gridview having a dropdown.
that comes from add list from the gridview.
now how can i add the values to the dropdown in gridview that show list at time of display.
and when i fill the form how the value store in the database.
Posted

Hello friend, You may visit the below link:
DropDownList in the GridView - Keeping asp.net forms control in GridView[^]
- DD
 
Share this answer
 
<text>Hi Friends, Your Solution is :
C#
protected void btnSave_Click(object sender, EventArgs e)
{
    List<int> list = new List<int>();
    foreach (GridViewRow r in gvOrder.Rows)
    {
        if (r.RowType == DataControlRowType.DataRow)
        {
            DropDownList ddl = r.FindControl("ddlDepartment") as DropDownList; 
                           
            int value = Convert.ToInt16(ddl.SelectedValue);
            list.Add(value);
           
        }
    }
}
</int></int>
 
Share this answer
 
v4
Comments
Nirav Prabtani 6-Jun-14 7:19am    
Oho nayan bhai rudani.. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900