i need to convert a field in gridview to a dropdownlist, but i need to do this in codebehind, and I cannot add a templatefield in apsx(but it could be created at run time execution...) I populate my grid with this code:
foreach (var item in response.Select(x => x.idMatriz).Distinct())
{
dr = dt.NewRow();
for (int i = 0; i < colunas; i++)
{
dr[i] = response.Where(x => x.Propriedade == dt.Columns[i].ToString() && x.idMatriz == item).Select(x => x.Valor).FirstOrDefault();
}
dt.Rows.Add(dr);
}
It works but i need this fileds be a dropdown.... any help?
It looks like all you need to do is dynamically create a template field and add it to the gridview.
After that, on the row created event of the gridview create and wire up the dropdown.