The DropDownList binding selects the data error notification exception solution
- 2020-05-24 05:19:17
- OfStack
Exception information thrown: exception details:
System.ArgumentOutOfRangeException: "ddlTotalCostDiscount" has an invalid SelectedValue because it is not in the project list.
DropDownList was originally assigned this way:
this. ddlTotalCostDiscount. SelectedValue = obj. TotalCostDiscount. ToString ();
Let's say I assign it like this:
ddlTotalCostDiscount.SelectedIndex = ddlTotalCostDiscount.Items.IndexOf(ddlTotalCostDiscount.Items.FindByValue(obj.TotalCostDiscount.ToString()));
The & # 8203; null, Items.IndexOf (null) returns -1 if the specified item is not found through FindByValue.
If there is anything wrong, you are welcome to correct it and make progress together.
System.ArgumentOutOfRangeException: "ddlTotalCostDiscount" has an invalid SelectedValue because it is not in the project list.
DropDownList was originally assigned this way:
this. ddlTotalCostDiscount. SelectedValue = obj. TotalCostDiscount. ToString ();
Let's say I assign it like this:
ddlTotalCostDiscount.SelectedIndex = ddlTotalCostDiscount.Items.IndexOf(ddlTotalCostDiscount.Items.FindByValue(obj.TotalCostDiscount.ToString()));
The & # 8203; null, Items.IndexOf (null) returns -1 if the specified item is not found through FindByValue.
If there is anything wrong, you are welcome to correct it and make progress together.