telerik window does not show
On page I write telerik window:
<telerik:RadWindow ID="Diction开发者_C百科aryWindow" runat="server"></telerik:RadWindow>
on this page I run javascript when user click on button:
<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>
an error apears: Object doesn't support this property or method. I find this javascript on the net like example. Is this the correct way to get telerik window to show? Can I get the window to appear some another way?
I would use the RadWindowManager to access your windows:
function UseRadWindow()
{
var oManager = GetRadWindowManager();
var oWnd = oManager.GetWindowByName("DictionaryWindow");
oWnd.setUrl("WebForm1.aspx");
oWnd.SetWidth(800);
oWnd.SetHeight(800);
oWnd.Show();
oWnd.Center();
}
You could also do it by accessing the window directly:
function UseRadWindow()
{
var oWnd = $find("<%= DictionaryWindow.ClientID %>");
oWnd.setUrl("WebForm1.aspx");
oWnd.SetWidth(800);
oWnd.SetHeight(800);
oWnd.Show();
oWnd.Center();
}
Take a look at their client-side API docs:
Telerik RadWindowManager Client-Side API
getElementById will return the element, while in order to get access to the control's client API, you need to get a reference to its object - that is why you need to use $find().
Javascript is a case-sensitive language. The telerik controls use (mostly) camel-casing for their javascript methods. According to the documentation, you probably want:
oWin.show();
oWin.center();
精彩评论