【问题标题】:RadButton Confirmation Dialog Not WorkingRadButton 确认对话框不起作用
【发布时间】:2016-07-12 18:00:21
【问题描述】:

我试图创建一个确认对话框但失败了。我的代码如下:

<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>

谢谢!

【问题讨论】:

  • 你遇到了什么错误?

标签: c# .net visual-studio telerik


【解决方案1】:

Telerik 的RadButton 控件包含一个用于显示确认消息的内置功能。最重要的是,您可以使用RadConfirmRadWindow控件自定义弹出窗口体验,实现起来并不难。请务必查看随附的链接以获取更多详细信息。

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

【讨论】:

    猜你喜欢
    • 2012-04-04
    • 1970-01-01
    • 1970-01-01
    • 2019-05-04
    • 2011-09-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多