1

I have a drop down that is bound to a set of values. When the user selects a value from another drop down the form gets populated. If the value exists in the database I want the value to be already chosen in the drop down. But with the option to choose a new value.

Note the dataset is bound at this point. I have tried

DataSet dsGetOrders = new DataSet();
foreach (DataRow dsGetOrdersRow in dsGetOrders.Tables[0].Rows)
{
    ddpDown.SelectedItem.Text =  dsGetOrdersRow["Vendor_Name"].ToString();
}

But this just adds the row in the drop down and doesn't make it the select value.

The drop down DataTextField and DataVaule are the same field. I even tried this without success:

ddpDown.DataTexField = dsGetOrdersRow["Vendor_Name"].ToString();
4

1 回答 1

0

尝试在下拉数据绑定事件中执行此操作。

于 2013-08-22T00:00:54.327 回答