Cascading dropdown with Ajax

3 posts, 0 answers
  1. RB
    RB avatar
    126 posts
    Member since:
    Dec 2013

    Posted 17 Apr 2014 Link to this post

    I am implementing cascading dropdownlist . The dropdown are in the radgrid Inline Edit Mode.
    protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
              if (e.Item is GridEditableItem && e.Item.IsInEditMode)
                  GridEditableItem item = e.Item as GridEditableItem;
                  GridEditManager manager = item.EditManager;
                  HyperLink hyperLink = (HyperLink)item["OrderTask"].Controls[0];
                  hyperLink.Visible = false;
                  DropDownList droplist = new DropDownList();
                  droplist.ID = "DropDownListOrderTask";
                  droplist.AutoPostBack = true;         
                  CascadingDropDown ccdOrderTask = new CascadingDropDown();
                  ccdOrderTask.ID = "ccdOrderTask";
                  ccdOrderTask.Category = "OrderTask";
                  ccdOrderTask.TargetControlID = "DropDownListOrderTask";
                  ccdOrderTask.PromptText = "Select Order Task";
                  ccdOrderTask.LoadingText = "Loading OrderTask";
                  ccdOrderTask.ServiceMethod = "BindOrderTask";
                  ccdOrderTask.ServicePath = "ajaxservice.asmx";                            
                  TextBox txt = (TextBox)item["TaskOwner"].Controls[0];
                  txt.Visible = false;
                  droplist = new DropDownList();
                  droplist.ID = "DropDownListTaskOwner";
                  CascadingDropDown ccdTaskOwner = new CascadingDropDown();
                  ccdTaskOwner.ID = "ccdTaskOwner";
                  ccdTaskOwner.Category = "TaskOwner";
                  ccdTaskOwner.ParentControlID = "DropDownListOrderTask";
                  ccdTaskOwner.TargetControlID = "DropDownListTaskOwner";
                  ccdTaskOwner.PromptText = "Select Task Owner";
                  ccdTaskOwner.LoadingText = "Loading Task Owner";
                  ccdTaskOwner.ServiceMethod = "BindTaskOwner";
                  ccdTaskOwner.ServicePath = "ajaxservice.asmx"; 

    OnPrerender I have the following:
    protected override void OnPreRender(EventArgs e)
               var ajaxManager = RadAjaxManager.GetCurrent(Page);
               if(ajaxManager != null)
                   ajaxManager.AjaxSettings.AddAjaxSetting(this._UpdatePanel, this._RadGrid1, this._RadLoadingPanel);         

    In the ajaxservice.asmx I have the following:

          public CascadingDropDownNameValue[] BindOrderTask(string knownCategoryValues, string category)
              OrderRequestTaskTypeTable _orderRequestTaskTypeTable = new OrderRequestTaskType_List().ExecuteTypedDataTable();
              List<CascadingDropDownNameValue> orderTaskDetails = new List<CascadingDropDownNameValue>();
              foreach(DataRow dtRow in _orderRequestTaskTypeTable.Rows)
                     String orderTaskId = dtRow["OrderRequestTaskTypeId"].ToString();
                     String orderTaskName = dtRow["DescriptionTaskType"].ToString();
                      //orderTaskDetails.Add(new CascadingDropDownNameValue(orderTaskId, orderTaskName));
                     orderTaskDetails.Add(new CascadingDropDownNameValue("orderTaskId", "orderTaskName"));
                return orderTaskDetails.ToArray();

    The 1st dropdown which calls BindOrderTask is empty! Am I missing something?
  2. RB
    RB avatar
    126 posts
    Member since:
    Dec 2013

    Posted 17 Apr 2014 Link to this post

    I forgot to mention that I want to add the cascading dropdownList for Inline Add New Record using Ajax.
  3. Marin
    Marin avatar
    1057 posts

    Posted 22 Apr 2014 Link to this post


    The configuration looks correct. You can check the Ajax Control ToolKit documentation for more information on the service binding of the CascadingDropDown extender. Additionally you can test how this works without any ajax on the page to determine whether the problem is in the CascadingDropDown extender databinding or the ajax configuration of the page. You can also check for any javascript errors on the page with any of the configurations.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top