none
How to savec exclusive cobo Box vallue back to DB with EF RRS feed

  • Question

  • Dear all,

    I have the following Datagrid:

    This grid is populated from existing values in DB from the Entity context. As you can see i have a ControlBox for Select fields which is exclusive ( I can have only one records with Select = set.

    From the exempla above , if I set the Select coloumn for First row and apply the change to database it works nicely but the problem is that in DB the previously set row remains.

    So what I need to do with EF, is that previously select row should be reset and newly set should be set.

    Any idea how can i do this ?

    Or shold I record somewhere in memeory all time the last select row before applying changes ?

    thnaks for help

    regards

    srge


    Your knowledge is enhanced by that of others.

    Thursday, May 31, 2012 1:05 PM

Answers

  • Hi Serge Calderara,

    Welcome to MSDN Froum.

    Based on this issue, we can write update command in SelectionChanged EventHandler, if the 'Select' has changed, the event will be fired, then update the current record which 'Select' just be set as 'set' and the previous record, set its 'Select' as 'unset'.

    By the way, it is not a EF issue, I suggest you to post it in WPF Forum for better help. If you need further help about EF, please feel free to let me know, I will be more than happy to be of assistance. : )

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    Sunday, June 3, 2012 6:04 AM
    Moderator

All replies

  • Do you have a list to contains all the records?
    Friday, June 1, 2012 7:28 AM
  • what do you mean ?

    Your knowledge is enhanced by that of others.

    Friday, June 1, 2012 7:30 AM
  • I don't think is an EF related question, if the select field changes, on tracked objects (by the context) when you save changes everything should be updated into the dB, so maybe is an architectural related problem.

    Hope it helps

    Friday, June 1, 2012 8:04 AM
  • I was expecting that also but seems not the case, how to check this then ?


    Your knowledge is enhanced by that of others.

    Friday, June 1, 2012 8:09 AM
  • Hi Serge Calderara,

    Welcome to MSDN Froum.

    Based on this issue, we can write update command in SelectionChanged EventHandler, if the 'Select' has changed, the event will be fired, then update the current record which 'Select' just be set as 'set' and the previous record, set its 'Select' as 'unset'.

    By the way, it is not a EF issue, I suggest you to post it in WPF Forum for better help. If you need further help about EF, please feel free to let me know, I will be more than happy to be of assistance. : )

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    Sunday, June 3, 2012 6:04 AM
    Moderator
  • Thanks Allen for your reply.

    I will try your suggestion but how to I know from the Select command, the previous selected item from grid?


    Your knowledge is enhanced by that of others.

    Monday, June 4, 2012 6:27 PM
  • Hi Serge Calderara,

    I'm afraind I'm not familar with WPF controls, so I suggest you to post in WPF Forum, there're more related experts there, I think you can get help more effectively. If encountering some EF issues, welcome to post in this forum, I will do my best to help you.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, June 5, 2012 2:52 AM
    Moderator