DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Bind Dropwdown In Gridview

01.27.2012
| 2017 views |
  • submit to reddit
        // Bind dropwdown in gridview

protected void GvTestGrid_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            DataTable dtData= new DataTable();
            dtData= GetData(); // Get your data to be binded to dropdown
            DropDownList ddlFileData= (DropDownList)e.Row.FindControl("DdlFileData");
            ddlFileData.Datasource = dtData;
            ddlFileData.DataBind();
         }
    }