【发布时间】:2013-04-25 11:40:48
【问题描述】:
我正在尝试显示一个确认框,它与 Confirm 完美配合,但不适用于我的自定义消息框,
这行得通,
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton link = (LinkButton)e.Row.Cells[4].Controls[2];
if (link != null)
{
link.OnClientClick = "return confirm('Do you really want to delete?')";
}
}
}
但是当我把这个改为
link.OnClientClick = "ConfirmationBox()";
function ConfirmationBox()
{
$.blockUI({ message: $('#question'), css: { width: '275px' }
});
}
它显示消息框,但随后它也删除了我的记录:'(
还在困惑吗?看看这个,
Command field showing messagebox
编辑
<script type="text/javascript">
$(document).ready(function() {
$('#yes').click(function() {
$.unblockUI();
return true;
});
$('#no').click(function() {
$.unblockUI();
return false;
});
});
</script>
【问题讨论】:
-
这是怎么回事?
-
我称之为深度编程 :)
标签: c# javascript gridview webforms