[英]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. 我需要在与母版页关联的所有内容页中使用radalert显示一条消息。
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. 我无法将JavaScript代码添加到母版页,因此必须在外部JavaScript文件中添加以下指定的代码。
When the below specified code is added to the content page, it displays the message before session expires. 将以下指定的代码添加到内容页面后,它将在会话过期之前显示该消息。 JavaScript code: JavaScript代码:
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 但是,当将代码添加到外部javascipt文件中以便可以在依赖于母版页的所有页面中实施代码时,在radalert处会出现“无法获取未定义或空引用的属性'radalert'”错误
If you are accessing radcontrols from external javascript. 如果您要从外部javascript访问radcontrols。 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. 上面的脚本与Radcontrols不同。 You need to add parameters 您需要添加参数
function open(sender, args)
{
radalert("Hello World", 320, 100, "Information Message");
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.