辐射按钮确认对话框不起作用
本文关键字:不起作用 对话框 确认 按钮 辐射 | 更新日期: 2023-09-27 17:56:31
我试图创建一个确认对话框,但失败了。我的代码如下:
<telerik:RadButton ID="RadButtonHelp" runat="server"
Text="Help" CausesValidation="false" CssClass="rbButton"
OnClientClick="if (!confirm('Are you sure you want to open help?')) return false;"
OnClick="RadButtonHelp_Click">
</telerik:RadButton>
谢谢!
Telerik的RadButton
控件包括用于显示确认消息的内置功能。最重要的是,您可以通过利用RadConfirm
或RadWindow
控制来自定义弹出窗口体验,这并不难实现。请务必查看随附的链接以获取更多详细信息。
.ASPX
<telerik:RadButton RenderMode="Lightweight" ID="btnStandardConfirm" runat="server" Text="Standard window.confirm" OnClientClicking="StandardConfirm" OnClick="Button_Click">
</telerik:RadButton>
代码隐藏
protected void Button_Click(object sender, EventArgs e)
{
RadButton btn = sender as RadButton;
switch (btn.ID)
{
case "btnStandardConfirm":
Label1.Text = "The <strong>StandardButton</strong> submitted the page at: " + DateTime.Now.ToString();
break;
}
}
.JS
function StandardConfirm(sender, args) {
args.set_cancel(!window.confirm("Are you sure you want to submit the page?"));
}
演示链接:http://demos.telerik.com/aspnet-ajax/button/examples/confirm/defaultcs.aspx