简体   繁体   English

保存之前触发RowEditEnded事件

[英]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.

相关问题 等待事件完成,然后再次触发 - Awaiting an event to complete before it gets fired again 在异步作废Dowork事件之前触发RunWorkerCompleted - RunWorkerCompleted fired before async void Dowork event Dotnetzip,保存后未触发事件处理程序 - Dotnetzip, Event Handler not Fired after Save 反正有没有阻止某个事件在另一个事件结束前被触发? - Is there anyway to prevent some event fired before end of another event? CompositeDataBoundControl-由于DummyDataSource而在触发事件之前覆盖了数据绑定值 - CompositeDataBoundControl - databound values overwritten before event is fired due to DummyDataSource 对于VSTO Word加载项:另存为后是否触发事件? - For VSTO Word add-in: Is there an event fired after Save-As? 如何确保在按钮的单击事件之前触发文本框的textchanged事件? - How can I make sure the textchanged event of a textbox is fired before the click event of a button? 在回发之前将数据保存在ViewState中的事件 - Event to save data in ViewState before postback 在ValidationGroup之前触发OnClientClick - OnClientClick fired before ValidationGroup 由于绑定到在模板布局之前触发的事件,因此命名范围问题 - Name scope issues due to binding to event that gets fired before template layout
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM