我正在尝试显示一个确认框,它与我的自定义消息框完美搭配,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' }
});
}
它显示消息框,但随后它也删除了我的记录:'(
还迷茫吗?看一下这个,
编辑
<script type="text/javascript">
$(document).ready(function() {
$('#yes').click(function() {
$.unblockUI();
return true;
});
$('#no').click(function() {
$.unblockUI();
return false;
});
});
</script>