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

Microsoft JScript runtime error Object doesn't support this property RadAjaxPanel Or UpdatePanel

2 Answers 228 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
msingh asked on 21 Dec 2008, 01:33 AM
I getting this wierd error and really struggling with it. I was able to make a simpler project and reproduce the problem. Here is the problem:

I've a RadGrid (with ClientSelect Column and another column) within a RadAjaxPanel. I select a row and click on a link (outside the grid but within radajaxpanel) to open up a RadWindow to do something. First time i select a row and click on the link, it promptly shows up a radwindow. I close the radwindow and try the same process again, this time i get runtime error - Microsoft JScript runtime error: Object doesn't support this property or method.

The problem goes away if I remove RadAjaxPanel. I tried same thing w/ UpdatePanel. However its the same issue...
I'm using VS2008 w/ Telerik Q2 904.35 version.

Here is the Default.aspx code:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server">  
    <title></title>  
      
</head> 
<body> 
    <form id="form1" runat="server">  
    <telerik:RadScriptManager ID="ScriptManager1" runat="server" EnableTheming="True"></telerik:RadScriptManager> 
    <telerik:RadScriptBlock runat="server">  
    <script type="text/javascript">  
    function ShipOut() {  
            var grid = $find("<%= RadGrid1.ClientID %>").get_masterTableView().get_selectedItems();  
            if (grid == null || grid.length < 1)  
                return;  
            var docids = "";  
            var docids1 = "";  
            for (i = 0; i < grid.length; i++) {  
                var dataitem = grid[i];  
                docidsdocids = docids + dataitem.get_cell("DocID").innerText + ",";  //.getDataKeyValue("DocID").toString();  
            }  
            if (docids.length > 1)  
                docidsdocids1 = docids.substring(0, docids.length - 1);  
            var wnd = window.radopen("CreateManifest.aspx?DocID=" + docids1, "ShipOut");  
            wnd.setSize(600, 400);  
            wnd.set_modal(true);  
            wnd.set_title("ShipOut");  
            wnd.add_close(OnClientClose);  
            return false;  
        }  
        function OnClientClose(sender, eventArgs) {  
            var btn = document.getElementById('btnRebind').click();  
        }  
    </script> 
    </telerik:RadScriptBlock> 
      
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="WebBlue"></telerik:RadWindowManager> 
    <div> 
        <telerik:RadTabStrip ID="RadTabStrip1" runat="server" AutoPostBack="true" MultiPageID="RadMultiPage1">  
        <Tabs> 
            <telerik:RadTab Text="page1" runat="server" PageViewID="RadPageView1"></telerik:RadTab> 
            <telerik:RadTab Text="page2" runat="server" PageViewID="RadPageView2"></telerik:RadTab> 
        </Tabs> 
        </telerik:RadTabStrip> 
        <asp:UpdatePanel runat="server"><ContentTemplate> 
          
        <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0">  
        <telerik:RadPageView ID="RadPageView1" runat="server">page 1</telerik:RadPageView> 
            <telerik:RadPageView ID="RadPageView2" runat="server">  
          
                <telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None">  
                    <MasterTableView> 
                        <RowIndicatorColumn> 
                            <HeaderStyle Width="20px" /> 
                        </RowIndicatorColumn> 
                        <ExpandCollapseColumn> 
                            <HeaderStyle Width="20px" /> 
                        </ExpandCollapseColumn> 
                        <Columns> 
                         <telerik:GridClientSelectColumn UniqueName="testselect"></telerik:GridClientSelectColumn>                           
                        </Columns> 
                    </MasterTableView> 
                    <ClientSettings> 
                        <Selecting AllowRowSelect="True" /> 
                    </ClientSettings> 
                    <FilterMenu EnableTheming="True">  
                        <CollapseAnimation Duration="200" Type="OutQuint" /> 
                    </FilterMenu> 
                </telerik:RadGrid> 
                <href="#" onclick="return ShipOut();" id="lnkShipOutwards" runat="server"   
                            enableviewstate="True">CREATE MANIFEST</a> 
        </telerik:RadPageView> 
        </telerik:RadMultiPage> 
    <asp:Button ID="btnRebind" runat="server" Text="Button" /> 
    </ContentTemplate></asp:UpdatePanel> 
    </div>      
    </form> 
</body> 
</html> 
 

Here is Default.aspx.cs code -

using System;  
using System.Collections.Generic;  
using System.Linq;  
using System.Web;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using System.Data;  
 
 
namespace WebApplication1  
{  
    public partial class _Default : System.Web.UI.Page  
    {  
        protected void Page_Load(object sender, EventArgs e)  
        {  
            if (!IsPostBack)  
            {  
                DataTable dT = new DataTable();  
                dT.Columns.Add("DocID");  
                DataRow row1 = dT.NewRow();  
                row1["DocID"] = 1;  
                dT.Rows.Add(row1);  
                row1 = dT.NewRow();  
                row1["DocID"] = 2;  
                dT.Rows.Add(row1);  
                row1 = dT.NewRow();  
                row1["DocID"] = 3;  
                dT.Rows.Add(row1);  
                row1 = dT.NewRow();  
                row1["DocID"] = 4;  
                dT.Rows.Add(row1);  
                row1 = dT.NewRow();  
                row1["DocID"] = 5;  
                dT.Rows.Add(row1);  
                dT.AcceptChanges();  
                RadGrid1.DataSource = dT;  
                RadGrid1.DataBind();  
            }  
 
        }          
    }  


CreateManifest.aspx code is just plain html.. w/ script manager... which is irrelevant.

PLEASE HELP!!

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimo
Telerik team
answered on 22 Dec 2008, 08:42 AM
Hello Mandeep,

Thanks for providing a sample page. Actually I don't see a RadAjaxPanel on it, but it is not related to the problem.

The name of the function, which opens the RadWindow, cannot have the same name as the name of the window, which you are specifying in the radopen method:

function ShipOut()
{
var wnd = window.radopen("CreateManifest.aspx?DocID=" + docids1, "ShipOut");
}

This is because in Javascripts functions are objects and the window is an object too. So you end up with two objects in the same scope and with the same name and they overwrite each other.

Please, either rename the function or the window name.

Alternatively, you can open new window objects without specifying a name:

var wnd = window.radopen("CreateManifest.aspx?DocID=" + docids1, null);


Here is a simple web page, which you can use to test:


<%@ Page Language="C#" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<script runat="server"
 
</script> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
<title>RadControls for ASP.NET AJAX</title> 
</head> 
<body> 
<form id="form1" runat="server">   
<telerik:RadScriptManager ID="ScriptManager1" runat="server" /> 
 
<script type="text/javascript">   
function MethodName() 
    var wnd = window.radopen("about:blank", "WindowName");   
    wnd.setSize(600, 400);   
    return false;   
}   
</script>  
   
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="WebBlue" /> 
 
<div> 
    <href="#" onclick="return MethodName();">CREATE MANIFEST</a>  
</div> 
 
</form>  
</body>  
</html>  



Best wishes,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
answered on 23 Dec 2008, 01:13 AM
Thank you. this definitely did the trick.
Tags
Ajax
Asked by
Answers by
Dimo
Telerik team
Share this question
or