Reputation: 10566
How to use radconfirm from JavaScript? Functions radalert or radconfirm not defined. Could someone please show me the sample?
for example when I call this function I get radalert is undefined:
function testWnd() {
radalert("Confirm returned the following result: " + arg);
}
Upvotes: 4
Views: 14221
Reputation: 1626
Please follow the below steps to achieve the radalert functionality from the client side:
Step 1: Markup.
On your web page please include an instance of RadWindowManager. Without this radalert, radconfirm or radprompt wont work. This is the backbone of this feature. Here is the code snippet:
<telerik:RadWindowManager ID="RadWindowManager1"
runat="server" EnableShadow="true">
</telerik:RadWindowManager>
Next place a normal button and handle its onclick event. Here is the code snippet:
<button style="width: 150px;"
onclick="radalert('Radalert is called from the client!',
330, 100,
'Client RadAlert',
alertCallBackFn, imgUrl); return false;">
radalert from client</button>
notice the callback for the radlalert named "alertCallBackFn". We will code that function in next section. Also note the use of the variable imgUrl variable. This defines the image to be used in the radalert. We will see what it does in the next section.
Step 2: Javscript
The radalert needs a image to be shown as part of the alert window. Declare a global variable by name "imgUrl" as below:
//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;
Then create the radalert call back function as below:
function alertCallBackFn(arg) {
radalert("<strong>radalert</strong> returned the following result: <h3 style='color: #ff0000;'>" + arg + "</h3>", null, null, "Result");
}
Now when you click on the radalert button, you will see the alert box being shown with your text.
Hope this was the solution you were looking for.
Lohith (Tech Evangelist, Telerik India)
Upvotes: 6
Reputation: 14088
did you see this example http://demos.telerik.com/aspnet-ajax/window/examples/browserdialogboxes/defaultcs.aspx I am sure that you did't include some TELERIK components to you page
Upvotes: 1