I'm trying to get the RadComboBox to work. I've downloaded the "Paging in RadComboBox' Load On Demand" example from http://www.telerik.com/community/code-library/aspnet-ajax/combobox/paging-in-radcombobox-load-on-demand.aspx, which works fine.
Now I want do duplicate this functionality, however I can't seem to get it working (for some reason no client or server events are firing), so I've downloaded the RadControlsAJAXCourseware.pdf courseware to follow the guide step-by-step but onn page 368 step 3 it asks for a folder "\VS Projects\Images\Colors" which I cannot find; there is no folder like this on my system.
I have installed "RadControls 'Prometheus' for ASPNET Q3 2007". Can you point me in the right direction as to any possible reasons why my events don't fire and/or this Colors folder? I'm assumming there will be a simple solution, but for the life of me I can't find it !?!
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> |
| <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> |
| <script language="javascript" type="text/javascript"> |
| function comboContact_OnClientItemsRequesting(sender, eventArgs) |
| { |
| var context = eventArgs.get_context(); |
| context["ContactType"] = "xxx"; |
| } |
| </script> |
| </telerik:RadCodeBlock> |
| <form id="form1" runat="server"> |
| <div> |
| <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> |
| </telerik:RadScriptManager> |
| <telerik:RadComboBox ID="comboContact" runat="server" EnableLoadOnDemand="true" OnClientItemsRequesting="comboContact_OnClientItemsRequesting" OnItemsRequested="comboContact_ItemsRequested" ShowDropDownOnTextboxClick="False" |
| ShowToggleImage="True" ItemRequestTimeout="1500" AppendDataBoundItems="True" ShowWhileLoading="False" AutoPostBack="True" > |
| <CollapseAnimation Duration="200" Type="OutQuint" /> |
| <ExpandAnimation Type="OutQuart" /> |
| <ItemTemplate> |
| <table style="width: 250px; text-align: left"> |
| <tr> |
| <td style="width: 100px;"> |
| <%# DataBinder.Eval(Container.DataItem, "FirstName") %> |
| </td> |
| </tr> |
| </table> |
| </ItemTemplate> |
| <HeaderTemplate> |
| <table style="width: 250px; text-align: left"> |
| <tr> |
| <td style="width: 100px;"> |
| FirstName |
| </td> |
| </tr> |
| </table> |
| </HeaderTemplate> |
| </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; |
| using Telerik.Web.UI; |
| public partial class _Default : System.Web.UI.Page |
| { |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| } |
| 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_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e) |
| { |
| //get a ref to the calling combo |
| RadComboBox combo = (RadComboBox)o; |
| string thePasedString = e.Context["ContactType"].ToString(); // /thePasedString/ should = "xxx", right? |
| combo.ClearSelection(); |
| combo.DataSource = GetAllContacts(); |
| combo.DataValueField = "ContactID"; |
| combo.DataTextField = "FirstName"; |
| combo.DataBind(); |
| } |
| } |