如何使用JavaScript中的Telerik RadConfirm

vmg*_*vmg 4 javascript jquery telerik

如何使用JavaScript的radconfirm?函数radalert或radconfirm未定义.有人可以给我看样品吗?

例如,当我调用此函数时,我得到radalert是未定义的:

function testWnd() {
                  radalert("Confirm returned the following result: " + arg);
        }
Run Code Online (Sandbox Code Playgroud)

kas*_*apa 6

请按照以下步骤从客户端实现radalert功能:


第1步:标记.


在您的网页上,请包含RadWindowManager的实例.没有这个radalert,radconfirm或radprompt将无法正常工作.这是此功能的支柱.这是代码片段:

<telerik:RadWindowManager ID="RadWindowManager1" 
                          runat="server" EnableShadow="true">
</telerik:RadWindowManager>
Run Code Online (Sandbox Code Playgroud)

接下来放置一个普通按钮并处理其onclick事件.这是代码片段:

<button style="width: 150px;" 
        onclick="radalert('Radalert is called from the client!', 
                          330, 100,
                          'Client RadAlert', 
                          alertCallBackFn, imgUrl); return false;">
        radalert from client</button>
Run Code Online (Sandbox Code Playgroud)

注意名为"alertCallBackFn"的radlalert的回调.我们将在下一节中编写该函数.还要注意使用变量imgUrl变量.这定义了在radalert中使用的图像.我们将在下一节中看到它的作用.


第2步:Javscript


radalert需要将图像显示为警报窗口的一部分.按名称"imgUrl"声明一个全局变量,如下所示:

//use custom image in the alert box
var imgUrl = "http://www.telerik.com/favicon.ico"; 
//do not show any image in the alert box
imgUrl = ""; 
//uses the default image in the alert box
imgUrl = null; 
Run Code Online (Sandbox Code Playgroud)

然后创建radalert回调函数,如下所示:

 function alertCallBackFn(arg) {
            radalert("<strong>radalert</strong> returned the following result: <h3 style='color: #ff0000;'>" + arg + "</h3>", null, null, "Result");
        }
Run Code Online (Sandbox Code Playgroud)

现在,当您单击radalert按钮时,您将看到与您的文本一起显示的警告框.

希望这是您正在寻找的解决方案.

Lohith(技术传播者,Telerik印度)