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

[Solved] RadComboBox not populating?

7 Answers 479 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Brad
Top achievements
Rank 1
Brad asked on 10 Dec 2008, 04:33 AM

I'm trying to get the RadComboBox to work. We're using the RadControls 'Prometheus' for ASPNET Q3 2007 version: 2007.03.1314.20 from the Telerik.Web.UI.dll.; I believe this version is for AJAX.

When the page appears, the combo box appears with the text containing the first row(as expected), but it seems to be disabled. Nothing happens when clicking the drop-down arrow, nor entering text into the combobox itself.

I have tested this exact code with an older version (RadControls fro ASP.NET Q3 2007: version 2.8.3.0 RadCombobox.Net2.dll; I believe this version is NOT for AJAX.) and it works perfectly. (The only difference is the removal of a RadScriptManager which was required for the Prometheus version.)

The goal is to implement the Load On Demand functionality - similar to the example here:
http://demos.telerik.com/aspnet-ajax/ComboBox/Examples/PopulatingWithData/AutoCompleteSql/DefaultCS.aspx
but the ItemsRequested event doesn't seem to fire when using the example given here:
http://www.telerik.com/help/aspnet-ajax/combo_loadondemandoverview.html
I have attached my code. Any help would be great.
Thanks.

 

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_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>Untitled Page</title> 
</head> 
<body> 
    <form id="form1" runat="server">  
    <div> 
      
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
        </telerik:RadScriptManager> 
          
        <telerik:RadComboBox ID="comboContact" runat="server" > 
        </telerik:RadComboBox> 
          
    </div> 
    </form> 
</body> 
</html> 
 

 

 

 

using System;  
using System.Data;  
using System.Configuration;  
using System.Web;  
using System.Web.Security;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using System.Web.UI.WebControls.WebParts;  
using System.Web.UI.HtmlControls;  
using System.Data.SqlClient;  
 
public partial class _Default : System.Web.UI.Page   
{  
    protected void Page_Load(object sender, EventArgs e)  
    {  
        comboContact.DataSource = GetAllContacts();  
        comboContact.DataValueField = "ContactID";  
        comboContact.DataTextField = "FirstName";  
        comboContact.DataBind();  
    }  
 
    private DataSet GetAllContacts()  
    {  
        DataSet retVal = null;  
 
        try 
        {  
            using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["mainConnectionString"].ConnectionString))  
            {  
                SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM Contact ORDER BY FirstName", conn);  
                DataSet ds = new DataSet();  
                da.Fill(ds);  
 
                retVal = ds;  
            }  
        }  
        catch (SqlException ex)  
        {  
 
        }  
 
        return retVal;  
    }  
 
}  
 

7 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 10 Dec 2008, 07:13 AM
Hi Brad,

Try adding ItemsRequested event handler to the RadComboBox, and also set EnableLoadOnDemand property to True inorder to fire the ItemsRequested event. The ItemsRequested event fires when the EnabledLoadOnDemand property is enabled and the user types text into the input field. The event is also fired when RadComboBox not having any items and drop-arrow image is clicked.

ASPX:
<telerik:RadComboBox ID="comboContact" Runat="server" MarkFirstMatch="True"  
         EnableLoadOnDemand="True" onitemsrequested="comboContact_ItemsRequested1"
</telerik:RadComboBox> 

CS:
protected void comboContact_ItemsRequested1(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e) 
   //Add items 

Thanks,
Shinu.
0
Brad
Top achievements
Rank 1
answered on 10 Dec 2008, 07:59 AM

Hi Shinu,

Thanks for the reply, however the problem still persists. I've followed your advice and used your code.
I've added the ItemsRequested event handler, and set the EnableLoadOnDemand property to True as requested.

The DataSource of the RadComboBox is definitely populated as I've set a breakpoint in the Page_Load and can view its data in debug mode.

I've set a breakpoint in the 'comboContact_ItemsRequested1' event handler and can confirm that execution never gets there.

When the combo is displayed on the page, I'm able to enter text into input field, but no event fires. Also, as before, nothing happens when clicking the drop-down arrow. Same issue in FireFox and Chrome.

To double-check, the MarkFirstMatch, EnableLoadOnDemand, onitemsrequested display the correct values in the Proprty Pages in design view for the control. Any further advice on trying to resolve this...?

ASPX:

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_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>Untitled Page</title> 
</head> 
<body> 
    <form id="form1" runat="server">  
    <div> 
      
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
        </telerik:RadScriptManager> 
          
        <telerik:RadComboBox ID="comboContact" Runat="server" MarkFirstMatch="True" EnableLoadOnDemand="True" onitemsrequested="comboContact_ItemsRequested1">  
        </telerik:RadComboBox> 
          
    </div> 
    </form> 
</body> 
</html> 
 

CS:

using System;  
using System.Data;  
using System.Configuration;  
using System.Web;  
using System.Web.Security;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using System.Web.UI.WebControls.WebParts;  
using System.Web.UI.HtmlControls;  
using System.Data.SqlClient;  
 
public partial class _Default : System.Web.UI.Page   
{  
    protected void Page_Load(object sender, EventArgs e)  
    {  
        comboContact.DataSource = GetAllContacts();  
        comboContact.DataValueField = "ContactID";  
        comboContact.DataTextField = "FirstName";  
        comboContact.DataBind();  
    }  
 
    private DataSet GetAllContacts()  
    {  
        DataSet retVal = null;  
 
        try  
        {  
            using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["mainConnectionString"].ConnectionString))  
            {  
                SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM Contact ORDER BY FirstName", conn);  
                DataSet ds = new DataSet();  
                da.Fill(ds);  
 
                retVal = ds;  
            }  
        }  
        catch (SqlException ex)  
        {  
 
        }  
 
        return retVal;  
    }  
 
    protected void comboContact_ItemsRequested1(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)  
    {  
        comboContact.DataSource = GetAllContacts();  
        comboContact.DataValueField = "ContactID";  
        comboContact.DataTextField = "FirstName";  
        comboContact.DataBind();  
    }  
}  
 

 

0
Princy
Top achievements
Rank 2
answered on 10 Dec 2008, 01:03 PM
Hi Brad,

Try adding ScriptManager available in the Microsoft Ajax Extensions suite and check whether it is working for you.

ASPX:
<asp:ScriptManager ID="ScriptManager1" runat="server">  
        </asp:ScriptManager> 

Thanks,
Princy.
0
Brad
Top achievements
Rank 1
answered on 11 Dec 2008, 12:43 AM
I've removed the RadScriptManager entry (and also removed the related http handler code in web.config;see below)
    <httpHandlers> 
      <add path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" validate="false" /> 
    </httpHandlers> 
 
as requested and replaced it with an asp ajax extension ScriptManager, yet still the event doesn't fire !?!

I've confirmed that other events are working by temporarily adding a standard asp.net button with it's server-side click event; and is firing as expected.

An interesting point I noticed was that an existing working project we've developed AND the "Paging in RadComboBox Load On Demand" example here: http://www.telerik.com/community/code-library/aspnet-ajax/combobox/paging-in-radcombobox-load-on-demand.aspx use Telerik.Web.UI.dll product version 2007.03.1425.20, whereas all the examples that I'm developing where the events arn't firing use a different version: Telerik.Web.UI.dll product version 2007.03.1314.20. Can I request the Radcontrols 'Prometheus' for ASPNET Q3 2007 Telerik.Web.UI.dll product version 2007.03.1425.20. My idea is to install this version on a fresh installation of Visual Studio 2005 and see if this could be the problem...

Otherwise, can you continue to suggest other reasons?
0
Brad
Top achievements
Rank 1
answered on 11 Dec 2008, 06:37 AM
I have installed a fresh copy of windows XP in a virtual machine, along with Visual Studio 2005, and RadControls_Prometheus_2007_3_1314_dev.exe and the above code still does not fire any events. Can I request an service pack upgrade? (To: http://www.telerik.com/products/aspnet-ajax/whats-new/release-history/q3-2007-sp2-version-number-2007-3-1425.aspx) (i.e. Q3 2007 Service Pack 2) This is the version number used for a code demo that i dled from telerik that worked in my dev environment, and the version also worked with an existing project we've developed. How do i go about this?
Thanks,

Brad.
0
Shinu
Top achievements
Rank 2
answered on 11 Dec 2008, 06:51 AM
Hi Brad,

I am using RadControls for asp.net AJAX(2008.3.1125.20). Try upgrading to the latest version of the RadControls.
Refer the following KB article to get details on upgrading RadControls from one version to another.
Updating RadControls for ASP.NET to another version or license

Shinu
 

0
SAI MRUDULA
Top achievements
Rank 1
answered on 28 Apr 2009, 02:01 PM
Hi Shinu,

I have a similar problem. (Version: 2008.3.1314.20) I have a combo box and a rad grid in the same page and somehow combobox events are not getting fired.
I have a similar rad combox working fine in an other aspx page. Could you please help me out with this? Here is my code for the ComboBox:

<

 

td> <telerik:RadComboBox

 

 

ID="RadComboBox1" runat="server"

 

 

Width="250px" Height="140px"

 

 

 

ShowMoreResultsBox="true"

 

 

EnableVirtualScrolling="true"

 

 

EnableLoadOnDemand="true"

 

 

OnItemsRequested="RadComboBox1_OnItemsRequested"></telerik:RadComboBox></td>


 

Tags
ComboBox
Asked by
Brad
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Brad
Top achievements
Rank 1
Princy
Top achievements
Rank 2
SAI MRUDULA
Top achievements
Rank 1
Share this question
or