drp.ClearSelection(); drp.Items.FindByText(dt.Rows[i]["ProductName"].ToString()).Selected = true; drp.Items.FindByValue(dt.Rows[i]["ProductListID"].ToString());
protected void GridView_RowDataBound(Object sender, GridViewRowEventArgs e) { if(e.Row.RowType == DataControlRowType.DataRow) { DropDown ddl = (DropDown)e.Row.FindControl("DropDownID"); ListItem li = new ListItem("Default text", "Default value"); ddl.Items.Add(li); ddl.DataSource = //your data items to bind the dropdown. ddl.Bind(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)