Skip to content

Replies

0
Marc Babin
Marc Babin answered on Sep 22, 2015 12:24 PM

OK i have implemented the derived class and created a combobox at runtime.

I am getting the same results.  the selected value reverts back to original on loss of focus.

On the new control i bound it to the new values:

           //ProducerTypeIdCombo.DataBindings.Add("Value", Producer, "ProducerTypeId");
            Combo1.DataBindings.Add("IntegerValue", Producer, "ProducerTypeId");

If i go back and change the column type in SQL to a nvarchar it will work as expected.  But I need valid columns types.

Any ideas?

0
Marc Babin
Marc Babin answered on Sep 19, 2015 2:58 PM

thanks for the reply.  Basically what i have determined is that somewhere along the way the bound value will only save back to a string column in the database.  If the column type in the entity is anything other than string it will not allow me to change the selected value of the combo. I dont know if this is a bug or how i have the entity framework setup.

Do you have a link to a reference on how to create the derived class? a quick search was overwhelming.

0
Marc Babin
Marc Babin answered on Sep 18, 2015 4:10 PM

OK I have narrowed it down to changing the database type back to a string from an int.

I am saving the value of an int but the binding will not allow me to change the selection unless the destination is an string.

The other combos that are having the same issue also have int or other types than string.

Anyway I can force the combo to have a int33 datatype?  assuming that will fix it.

0
Marc Babin
Marc Babin answered on Sep 17, 2015 7:45 PM

I am not sure how to post any additional samples?

Perhaps there is another way to look at the properties of the control when at a break?

I am not an expert.

0
Marc Babin
Marc Babin answered on Sep 17, 2015 3:37 PM

'Producer' is a datatable in a entity context.  It is not a identity column and its not readonly.

The only difference is that the Status column is a string and i am saving an int, where Producertypeid is an Int32 saving an int.