Hi
how to create comboboxes dynamically in datagridview
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Soft CornerPosted Dec 28, 2010, 1:04 AM
public Form1()
{
InitializeComponent();
DataGridViewComboBoxColumn combo = new DataGridViewComboBoxColumn();
combo.HeaderText = "UserText";
dataGridView1.Columns.Add(combo);
}
rajesh nPosted Dec 28, 2010, 12:20 AM
Suthish NairPosted Dec 27, 2010, 3:37 AM
Soft CornerPosted Dec 27, 2010, 2:03 AM
try this
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DropDownList ddlnewList = new DropDownList();
ddlnewList.DataBind();
TableCell tc = new TableCell();
tc.Controls.Add(ddlnewList);
e.Row.Cells.AddAt(0, tc);
}
}