This is a migrated thread and some comments may be shown as answers.

RadWindow show is not working

1 Answer 310 Views
Window
This is a migrated thread and some comments may be shown as answers.
Kunal Bagga
Top achievements
Rank 1
Kunal Bagga asked on 13 Mar 2014, 11:51 AM
Hi I am doing a very simple example of showing a RadWindow on click of a Button. But the window never shows up. 

Here is the aspx page that I have

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RadWindow.aspx.cs" Inherits="DotNetExercises.RadWindow" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">
        function click123() {
            alert("Hello");
            var oWnd = document.getElementById("RadWindow1");
            alert(oWnd);
            oWnd.show();
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <asp:ScriptReference Assembly="Telerik.Web.UI" 
                Name="Telerik.Web.UI.Common.Core.js">
            </asp:ScriptReference>
            <asp:ScriptReference Assembly="Telerik.Web.UI" 
                Name="Telerik.Web.UI.Common.jQuery.js">
            </asp:ScriptReference>
            <asp:ScriptReference Assembly="Telerik.Web.UI" 
                Name="Telerik.Web.UI.Common.jQueryInclude.js">
            </asp:ScriptReference>
        </Scripts>
    </telerik:RadScriptManager>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
    </telerik:RadWindowManager>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <div>
        Welcome to the RadWindow Page.. 
    </div>
    <telerik:RadWindow ID="RadWindow1" runat="server" NavigateUrl="http://www.google.com">
    </telerik:RadWindow>
    <br />
    <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="click123()" />
    <br />      
    </form>
</body>
</html>  








1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 13 Mar 2014, 12:12 PM
Hi Kunal,

I strongly advise that you start by examining the following help article that explains how to open RadWindows: http://www.telerik.com/help/aspnet-ajax/window-programming-opening.html.
The key points related to your code are:
- you need to use  $find() instead of document.getElementById();
- it is advisable to use the ClientID from the server via server code blocks to accommodate for ID changes by ASP.
- you should cancel the postback from the button by adding a return false; statement to the script.

Regards,
Marin Bratanov
Telerik

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

Tags
Window
Asked by
Kunal Bagga
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or