Detailsview dropdownlist not updating
By binding the Drop Down List control to a Sql Data Source control, we can populate the Drop Down List control with the data present in the database The below code demonstrates how to place a Drop Down List control in a Edit Item Template and Insert Item Template. The difference between the Eval() method and the Bind() method is: We use Eval() method to display data and this data is not going to take part in Insert and Update operations.The Edit Item Template is used to display user interface while Details View control is in edit mode. We use Bind() to display data and this data can take part in Insert and Update operations.We do so because, when Details View is in Edit mode, it is necessary to provide a list of groups using the dropdownlist control from where the user will edit a group to which the account belongs. Similarly, when Details View is in Insert mode, we provide a list of groups from where the user will select a group to which the account belongs. (Sorry, I can not format in comment box here)This is a Details View, so when I click Edit, the field Vendor Name and Vendor BUName change to dropdownlist, the Selected Value will selected the current Vendor ID and Vendor BUID in the listed items.If I remove the Selected Value, it will not select the correct value when I click Edit.
I have a problem and I am not sure why this is happening. NET and currently having problem with dropdownlists in the Details View. Invalid Operation Exception: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control. Please look at the post again try to evaluate yours wording "you should be kind to", where is in the post that is not kind? If you would like to help, then much much appreciated!I have this code my code behind to refresh the list for the dropdownlists in Details View Problem is: If I leave Selected Value= there, the dropdownlists in Edit mode seletected the correct value in the items listed when I first click Edit, but when I select a new Vendor Name, it errors "Databining method such as Eval(), Xpath(), and Bind()... Now, if I removed the Selectedvalued for the dropdownlists, it will work for refreshing the Vendor BUName when select a new Vendor Name, but NOT not selected the default Vendor ID when I click "Edit". Edit: Since binding a value to the Selected Value with Data Binder didn't work, you can try to set the value when binding data.Any suggestion to modify the code behide to bind with whatever Selected Value from Vendor Name? It looks like this question was addressed here, but his solution did not work for me.