ASPxGridView 自定义CommandColumnButton
我通过添加到我的 ASPxGridView GridViewColumnCustomButton 来实现自定义删除。
然后在我的 GridView 上我处理 ClientSideEvent
<ClientSideEvents CustomButtonClick="function(s, e) { customButton_OnClick(s, e); }" />
JS:
function customButton_OnClick(s, e) {
if (e.buttonID == "customButtonId") {
e.processOnServer = confirm("Really want to delete?");
}
}
我还添加到我的网格:
OnCustomButtonCallback="GvMyGridViews_OnCustomCallback"
现在在服务器端我用户 linq 删除指定的行,然后提交对我的 DataContext 的更改,然后在我的网格上提交 DataBind() 。
问题是,有时标准 ASPxGridView 加载面板显示大约 1 秒,然后我的行消失,因此它表现正常,但有时加载面板停止移动。我需要将鼠标移到网格上或单击按钮,以便更新我的网格(行消失)。
您知道问题出在哪里吗? 感谢您的帮助
Im implementing custrom delete by adding to my ASPxGridView GridViewColumnCustomButton.
Then on my GridView I handle ClientSideEvent
<ClientSideEvents CustomButtonClick="function(s, e) { customButton_OnClick(s, e); }" />
JS:
function customButton_OnClick(s, e) {
if (e.buttonID == "customButtonId") {
e.processOnServer = confirm("Really want to delete?");
}
}
Ive also added to my grid:
OnCustomButtonCallback="GvMyGridViews_OnCustomCallback"
now on the server side I user linq to delete specified row and then submit changes to my DataContext and then DataBind() on my grid.
Problem is that sometimes standard ASPxGridView loading panel is shown for about 1 second ant then my row dissapears so it behaves properly but sometimes loading panel stops mooving. and I need to move mouse over my grid or click button so that my Grid is updated(row dissapears).
Have You got any Idea where the problem is ?
Thanks for help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
很难回答你的问题。当您调用网格的 DataBind 方法时,请尝试确定该行是否实际上已从数据库中删除。另外,我怀疑 ASPxGridView 绑定到 LinqDataSource 对象。如果是这样,我建议您记录它返回的数据并检查删除的行是否在列表中。这是可能的,因为该组件可以缓存数据并返回无效的记录集。要确定 LinqDataSource 返回哪些数据,您可以使用
http:// 中的代码forums.asp.net/p/1583916/3998100.aspx
It it hard to answer your question. Please try to determine if the row was actually deleted from the DB when you call the grid's DataBind method. Also, I suspect that the ASPxGridView is bound to a LinqDataSource object. If so, I suggest that you log which data it returns and check if a row deleted is in the list. It is possible since this component can cache data and return a non valid recordset. To determine which data is returned by the LinqDataSource, you may use the code from
http://forums.asp.net/p/1583916/3998100.aspx
确保删除自定义按钮回调处理程序末尾的记录后设置数据源,然后重新绑定网格。如果您只调用 DataBind() 而不设置数据源,它将无法正常工作。 IE。
Make sure that after you delete the record at the end of your custombuttoncallback handler that you SET THE DATASOURCE then rebind the grid. If you just call DataBind() without setting the datasource it will not work properly. Ie.