我的.ascx有以下作品
function confirmationDelete()
{
var r = confirm("Are you sure you want to delete this target");
if (r == true) {
return true;
} else {
return false;
}
}
<asp:Button ID="btnDeleteTarget" runat="server" Text="Delete Target" CssClass="btnDeleteTargetClass" ValidationGroup="validateformgroup" CausesValidation="true" OnClick="btnDeleteTarget_Click" Visible="False" />
ascx.cs位于行
之下btnDeleteTarget.OnClientClick = "return confirmationDelete()";
我仍然没有得到确认提示。页面只是刷新。我究竟做错了什么?
尝试在开发人员工具栏中放置断点,但它没有调用我的JS函数。
答案 0 :(得分:0)
试试这段代码
在 * .ascx :
中object Abcd {
object Def extends Service[Post]("mydb", abc) {
def test = {
//db
val q = query.drop(1).take(20)
val r = db.run(q.result)
println(q.result.statements.head)
println(r)
r
}
}
private def abc(tag: Tag) = new Post(tag)
}
.cs C#:
<asp:Button ID="btnDeleteTarget" runat="server" Text="Delete Target" CssClass="btnDeleteTargetClass" ValidationGroup="validateformgroup" CausesValidation="true" OnClick="btnDeleteTarget_Click" Visible="False" />
答案 1 :(得分:0)
在按钮OnClientClick属性中使用此项:
OnClientClick="return confirm('Are you sure you want to delete?');"
这将是您的代码:
<asp:Button ID="btnDeleteTarget" runat="server" Text="Delete Target" CssClass="btnDeleteTargetClass" ValidationGroup="validateformgroup" CausesValidation="true" OnClientClick="return confirm('Are you sure you want to delete?');" Visible="False" />