error with xmlhttppanel and combobox with checkboxes

4 posts, 1 answers
  1. moegal
    moegal avatar
    273 posts
    Member since:
    Jul 2007

    Posted 05 Nov 2012 Link to this post

    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
  2. Answer
    Slav
    Admin
    Slav avatar
    1356 posts

    Posted 06 Nov 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. moegal
    moegal avatar
    273 posts
    Member since:
    Jul 2007

    Posted 06 Nov 2012 Link to this post

    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
  5. Slav
    Admin
    Slav avatar
    1356 posts

    Posted 09 Nov 2012 Link to this post

    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.
Back to Top