{"'DDLShipmentType' has a SelectedIndex which is invalid because it does not exist in the list of items.\r\nParameter name: value"}
cmb_ShipmentType.SelectedIndex = 0;
public void PopulateShipmentType(DropDownList cmb_ShipmentType) { string Sql = "select a,b from xxx where NUIsActive=1"; using (DataView Source = new DataView(objDBLib.ExecuteQuery(Sql).Tables[0])) { cmb_ShipmentType.DataSource = Source; cmb_ShipmentType.DataTextField = "a"; cmb_ShipmentType.DataValueField = "b"; cmb_ShipmentType.DataBind(); cmb_ShipmentType.SelectedIndex = 0; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)