2011-06-15 95 views
1

頁上寫我Telerik的窗口:Telerik的窗口不顯示

<telerik:RadWindow ID="DictionaryWindow" runat="server"></telerik:RadWindow> 

這個網頁上我運行JavaScript時按鈕用戶點擊:

<script type="text/javascript"> 
function getWindow() { return document.getElementById("<%= DictionaryWindow.ClientID %>"); } 

var oWin = getWindow(); 
    if (oWin != null) {    
     oWin.setUrl("WebForm1.aspx"); 
     oWin.set_width(800); 
     oWin.set_height(800); 
     oWin.Show(); 
     oWin.Center(); 

    } 
</script> 

錯誤apears:對象不支持這個屬性或方法。 我在網上找到這個javascript像例子。 這是獲得telerik窗口顯示的正確方法嗎?我可以讓窗戶以另一種方式出現嗎?

+2

請接受一些你以前的問題的答案第一。 – Kon 2011-06-15 13:24:56

+0

在哪一行中得到這個錯誤? – JAiro 2011-06-15 13:26:10

+0

on line:oWin.setUrl(「WebForm1.aspx」);我觀察運行時間的工作,並且它表明那些沒有方法setUrl()和其他方法的對象。 – 2011-06-15 13:27:59

回答

-2

JavaScript是一種區分大小寫的語言。 telerik控件爲他們的javascript方法使用(大部分)camel-casing。根據該文件,你可能想:

oWin.show();

oWin.center();

+0

這是不正確的。看看他們的API文檔:http://www.telerik.com/help/aspnet/window/radwindowobjectclientside.html – 2011-06-17 11:46:06

-1

的getElementById將返回元素,而爲了獲得訪問控制的客戶端API,你需要去的對象的引用 - 這就是爲什麼你需要使用$ find()方法。

0

我會用RadWindowManager來訪問你的窗戶:

function UseRadWindow() 
{ 
    var oManager = GetRadWindowManager(); 
    var oWnd = oManager.GetWindowByName("DictionaryWindow"); 
    oWnd.setUrl("WebForm1.aspx");   
    oWnd.SetWidth(800); 
    oWnd.SetHeight(800); 
    oWnd.Show(); 
    oWnd.Center(); 
} 

你也可以做到這一點通過直接訪問窗口:

function UseRadWindow() 
{ 
    var oWnd = $find("<%= DictionaryWindow.ClientID %>"); 
    oWnd.setUrl("WebForm1.aspx");   
    oWnd.SetWidth(800); 
    oWnd.SetHeight(800); 
    oWnd.Show(); 
    oWnd.Center(); 
} 

看看他們的客戶端API文檔:

Telerik RadWindowManager Client-Side API