Click here to Skip to main content
15,883,705 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to save entity when DataGrid's RowEditEnded event happen,like this:
Grid.RowEditEnded += (s, e) =><br />
    {<br />
        if (e.EditAction == DataGridEditAction.Commit)<br />
        {<br />
            //DoSave();<br />
        }<br />
    };

But the RowEditEnded event happen when DataGrid Control lost focus and e.EditAction=DataGridEditAction.Commit.
In this case,I don't want to do anything.
What should I do ? When e.EditAction=DataGridEditAction.Cancle in the above example?
Posted

1 solution

My solution:
Save entity when DataGrid's SelectedChanged event happen, like this:
<br />
    Grid.SelectedChanged+=(s,e)=><br />
    {<br />
        //DoSave();<br />
    };<br />

The entity to be save is current DataGrid's SelectItem,but it have already changed when SelectedChanged event happend,so I have to do anther thing to insure the to save entity is the previous SelectItem of Grid.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900