简体   繁体   中英

How to call Telerik radalert from external JavaScript in ASP.Net master page

I need to show an message using radalert in all the content pages associated with the master page.

I am not able to add the JavaScript code to the master page, so i had to add the below specified code in external JavaScript file.

When the below specified code is added to the content page, it displays the message before session expires. JavaScript code:

 var sessionTimeoutWarning = "1";
 var sessionTimeout = "2";
 var timeOnPageLoad = new Date();

setTimeout('RedirectToWelcomePage()', parseInt(sessionTimeout) * 60 * 1000);

 function RedirectToWelcomePage() {
        var message = "Session expired. Redirecting to Login page";
        radalert(message, 320, 100, "Information Message");
        window.location = "Login.aspx"
    }   

But when the code is added to the external javascipt file so that it can be implemented in all the pages dependent on the master page it gives "Unable to get property 'radalert' of undefined or null reference" error at the radalert

If you are accessing radcontrols from external javascript. You should be aware of parameters for that function..

For example :

function open()
{
window.open("Hello World", 320, 100, "Information Message");
}

The above script is not as same for Radcontrols. You need to add parameters

function open(sender, args)
{
radalert("Hello World", 320, 100, "Information Message");
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM