Jquery 中的 GridView 行
我有一个 gridview,它有一个用于删除行的 asp 图像按钮。我在删除行时实现了淡入淡出效果;工作正常。我的问题是淡入淡出效果始终有效 - 无论用户单击“确定”还是“取消”。仅当用户单击确认框的“确定”时,我才想要淡入淡出效果。我被困住了。下面是我的淡入淡出效果代码。
function removeRow() {
if (confirm("Are you sure you want to delete this comment?")) {
$("#dnn_BlogCommentManager1_grdBlogComments td: input[type='image']").click(function () {
$tr = $(this).closest("tr");
if ($(this).hasClass("imgDelete")) {
$tr.css("background-color", "red");
$tr.fadeOut(500, function () { $tr.remove() });
}
});
}
else {
return false;
}
}
我知道我无法将单击事件放置在函数内,但我不知道如何在 removeRow
函数内获取单击的行。
I have a gridview which has an asp image-button for deleting a row. I implemented a fade effect while the row is being deleted; that's working fine. My problem is the fade effect works always - whether the user has clicked ok or cancel. I want the fade effect only when user has clicked ok for the confirm box. I am stuck. Below is my code for the fade effect.
function removeRow() {
if (confirm("Are you sure you want to delete this comment?")) {
$("#dnn_BlogCommentManager1_grdBlogComments td: input[type='image']").click(function () {
$tr = $(this).closest("tr");
if ($(this).hasClass("imgDelete")) {
$tr.css("background-color", "red");
$tr.fadeOut(500, function () { $tr.remove() });
}
});
}
else {
return false;
}
}
I know I cannot place the click event inside the function, but I don't know how I can get the clicked row inside the removeRow
function.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
谢谢 Adam,它完成了,而不是 qquery 点击事件之外的 if 条件,我将其放在点击事件内,如下所示
无论如何,感谢您表现出您的关心......非常感谢。
Thanks Adam, its done instead of the if condition outside the qquery click event, i put it inside the click event like below
Anyways thanks for showing your concern... thanks a lot.