ListBox Save

Hi

Thanks for the reply.
I chased down the ef exception. You have to turn the IEnumerable into a List then iterate over the list calling the update for each item.

Other issues:

  1. If the listbox is multiselect, and you use a form, the form submit should post back an IEnumerable of type T but it only posts back a single object T,

  2. When setting the Value property, I would assume it would accept a List of my objects that need to be selected on init. The ValueProperty would tell it what property to use, ie the ID or key of the list. That doesn't work, rather I have to pass an array of ints containing the PK (assuming my pk are ints). that then shows the selected items in the list box correctly and updates this list.

In the end I got it to work, I removed the form and handled the listbox clicks on the change event, I then had to add a @bind-Value and remove the Value entry to get it to bind so when I handled the change event I could update the actual objects from the list of ints that get passed in the change event and pass each object to the update (making sure the IEnumerable was converted to a list first to stop ef erroring)

Thanks
Tim