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

error with xmlhttppanel and combobox with checkboxes

3 Answers 51 Views
XmlHttpPanel
This is a migrated thread and some comments may be shown as answers.
moegal
Top achievements
Rank 1
moegal asked on 05 Nov 2012, 11:21 AM
I have a page with a combo(ComboBox1) in a xmlhttppanel(XmlPanel1) and also a stand alone checkbox combo(RadComboBox1). After I call XmlPanel1  and select an item from ComboBox1,  then select a checkbox item from the RadComboBox1 I get an error.

I have created a very simple example to show the error. Am I doing something wrong?

Uncaught TypeError: Cannot call method 'get_checked' of null

Telerik.Web.UI.WebResource.axd: 3642

c.RadComboBox.prototype._onCheckBoxCheck=function(f){var d=f.target.nodeName;
if(d=="LABEL"){f.preventDefault();
}var h=this._findNearestItem(f.target);
var j=h!=null?h:this._extractItemFromDomElement(f.target);
if(this.raise_onItemChecking(j,f)){f.preventDefault();
return;
}j.set_checked(!j.get_checked());
Uncaught TypeError: Cannot call method 'get_checked' of null
this.raise_onItemChecked(j,f);
this._updateComboBoxText();
if(this._checkAllItemsElement!=null){this._updateCheckAllState();
}if(this._postBackOnCheck){var g={Command:"Check",Index:j.get_index()};
this.postback(g);
}};


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Main.aspx.cs" Inherits="Main" %>
 
<%@ 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">
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
        <script type="text/javascript">
            function SetValue() {
                var panel = $find("<%=XmlPanel1.ClientID %>");
                panel.set_value("test");
            }
        </script>
    </telerik:RadScriptBlock>
        <div>
    <telerik:RadComboBox ID="RadComboBox1" runat="server" CheckBoxes="true" EnableCheckAllItemsCheckBox="true"
        Width="300" Label="Select book genres:">
        <Items>
            <telerik:RadComboBoxItem Text="Arts" />
            <telerik:RadComboBoxItem Text="Biographies" />
            <telerik:RadComboBoxItem Text="Children's Books" />
            <telerik:RadComboBoxItem Text="Computers & Internet" />
            <telerik:RadComboBoxItem Text="Cooking" />
            <telerik:RadComboBoxItem Text="History" />
            <telerik:RadComboBoxItem Text="Fiction" />
            <telerik:RadComboBoxItem Text="Mystery" />
            <telerik:RadComboBoxItem Text="Nonfiction" />
            <telerik:RadComboBoxItem Text="Romance" />
            <telerik:RadComboBoxItem Text="Science Fiction" />
            <telerik:RadComboBoxItem Text="Travel" />
        </Items>
    </telerik:RadComboBox>
        </div>
    <div>
        <input value="Set Value" onclick="SetValue(); return false;" type="button" />
        <div>
            <telerik:RadXmlHttpPanel ID="XmlPanel1" runat="server" OnServiceRequest="XmlPanel1_ServiceRequest"
                EnableClientScriptEvaluation="true">
                <telerik:RadComboBox ID="ComboBox1" runat="server">
                </telerik:RadComboBox>
            </telerik:RadXmlHttpPanel>
        </div>
 
    </div>
    </form>
</body>
</html>


using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
 
public partial class Main : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
 
    protected void XmlPanel1_ServiceRequest(object sender, Telerik.Web.UI.RadXmlHttpPanelEventArgs e)
    {
        ArrayList itemsList = new ArrayList();
        itemsList.Add("Beverages");
        itemsList.Add("Condiments");
        itemsList.Add("Confections");
        ComboBox1.DataSource = itemsList;
        ComboBox1.DataBind();
    }
}

the error is stopping my other javascript code from working.

Help!! Marty

3 Answers, 1 is accepted

Sort by
0
Accepted
Slav
Telerik team
answered on 06 Nov 2012, 12:08 PM
Hello Marty,

It appears that your problem stems from a known compatibility issue of RadXmlHttpPanel with RadScriptManager. You can find more information about the problem as well as solutions in this help article.

Feel free to contact us again if you run into more difficulties.

Greetings,
Slav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
moegal
Top achievements
Rank 1
answered on 06 Nov 2012, 01:40 PM
Slave,

Thanks, I set EnableScriptCombine="false" and I got rid of the error. I really do not like all of the separate files though.  not sure why the panel would create these kinds of problems.

Marty
0
Slav
Telerik team
answered on 09 Nov 2012, 11:30 AM
Hi Marty,

I am glad this helped you resolve the problem!

As explained in the linked help article, the page does not go through the normal life cycle when RadXmlHttpPanel is used. This requires evaluation of the scripts and stylesheets that are loaded by the controls in the panel, which is not possible if RadScriptManager or RadStyleSheetManager is used on the page, i.e. the scripts (and the stylesheets) are combined into a single file.

Regards,
Slav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
XmlHttpPanel
Asked by
moegal
Top achievements
Rank 1
Answers by
Slav
Telerik team
moegal
Top achievements
Rank 1
Share this question
or