protected void GridViewCreateOrder_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { List <string> itemcodeddl = POC.GetAllItemCode(); List <string> categoryddl = POC.GetAllItemCategory(); List <string> descddl = POC.GetAllItemDesc(); TextBox tbUOM = new TextBox(); drp1 = (DropDownList)e.Row.FindControl("DropDownListCategory"); drp2 = (DropDownList)e.Row.FindControl("DropDownListItemCode"); drp3 = (DropDownList)e.Row.FindControl("DropDownListDesc"); tbUOM = (TextBox)e.Row.FindControl("TextboxUOM"); if (drp1 != null) { // populate drpnop items foreach (string category in categoryddl) { drp1.Items.Add(new ListItem(category, category)); } foreach (string itemcode in itemcodeddl) { drp2.Items.Add(new ListItem(itemcode, itemcode)); } foreach (string desc in descddl) { drp3.Items.Add(new ListItem(desc, desc)); } tbUOM.Text = POC.GetDefaultItem().UOM; } } }