[英]RowEditEnded event fired before save
I have a list of items in a RadGridView element. 我在RadGridView元素中有一个项目列表。 The element has a RowEditEnded eventhandler attached to it so that whenever a row in the grid is finished editing, the handler gets fired.
元素具有附加的RowEditEnded事件处理程序,以便每当网格中的一行完成编辑时,都会触发该处理程序。 There's a save button which is attached to another eventhandler.
有一个保存按钮连接到另一个事件处理程序。 My problem is that the RowEditEnded handler for the last row that was edited doesn't get fired when the user makes changes to a row and clicks 'Save' button without deselecting the edited row.
我的问题是,当用户对行进行更改并单击“保存”按钮而不取消选择已编辑的行时,最后被编辑的行的RowEditEnded处理程序不会被触发。 The RowEditEnded event gets fired for that row when the items on the list is reloaded (for refreshing the view).
重新加载列表中的项目(用于刷新视图)时,将针对该行触发RowEditEnded事件。
Is there a way to fire the RowEditEnded handler before the save handler? 有没有一种方法可以在保存处理程序之前触发RowEditEnded处理程序?
If deselecting the edited row results in a RowEditEnded
event, then my proposed solution is to programmatically deselect when the save button is clicked and then proceed with your save logic. 如果取消选择已编辑的行会导致
RowEditEnded
事件,那么我建议的解决方案是在单击保存按钮时以编程方式取消选择,然后继续保存逻辑。
private void HandleSaveClicked(object sender, EventArgs args)
{
m_gridView.SelectedIndex = -1;
SaveAllEdits();
}
Are you sure the deselection fires the RowEditEnded? 您确定取消选择会触发RowEditEnded吗? Because I had similar issues with a
TextBoxe
and a submit Button
: the TextBox updates the boud DataContext with the latest changes on LostFocus
by default (which is fired asynchronously). 因为我在使用
TextBoxe
和Submit Button
遇到了类似的问题:默认情况下,TextBox会使用LostFocus
上的最新更改来更新boud DataContext(这是异步触发的)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.