Invoke ClientDataSource OnCustomParameter event after changing radcombobox selection

2 posts, 0 answers
  1. Raeshawn
    Raeshawn avatar
    9 posts
    Member since:
    Jul 2013

    Posted 19 Nov 2016 Link to this post

    i'm cascading dropdownbox (radcombobox) with clientdatasource but i'm a having challenges when changing the main combobox in hopes of having oncustomparameter to fire again.

    ComboBox

    <telerik:RadComboBox runat="server" EmptyMessage="Function" ID="RcbFun" Width="80px" OnClientLoad="Rcb_OnClientLoad" DataTextField="Code" DataValueField="Functions" AppendDataBoundItems="True" ClientDataSourceID="CdsFunc" ItemsPerRequest="15" Filter="Contains"  EnableLoadOnDemand="true" ShowMoreResultsBox="true" EnableVirtualScrolling="true" OnClientSelectedIndexChanged="Rcb_OnClientSelectedIndexChanged"></telerik:RadComboBox>
     
    <telerik:RadComboBox runat="server" EmptyMessage="Sub-Function" ID="RcbSubF" Width="80px" OnClientLoad="Rcb_OnClientLoad"  DataTextField="Code" DataValueField="SubFunction" AppendDataBoundItems="True" ClientDataSourceID="CdsSubF" ItemsPerRequest="15" Filter="Contains" HighlightTemplatedItems="true" OnClientSelectedIndexChanged="Rcb_OnClientSelectedIndexChanged" EnableLoadOnDemand="true"></telerik:RadComboBox>

     

     

    RadClientDataSource

    <telerik:RadClientDataSource ID="CdsFunc" runat="server">
              <DataSource>
                  <WebServiceDataSourceSettings BaseUrl="LibraryService.svc/">
                      <Select Url="GetFunctions" DataType="JSON" RequestType="Get" ContentType="application/json; charset=utf-8" />
                  </WebServiceDataSourceSettings>
              </DataSource>
              <Schema DataName="d">
              </Schema>
          </telerik:RadClientDataSource>
          <telerik:RadClientDataSource ID="CdsSubF" runat="server">
              <ClientEvents OnCustomParameter="ParamMap" />
              <DataSource>
                  <WebServiceDataSourceSettings BaseUrl="LibraryService.svc/">
                      <Select Url="RcbGetSubFunctions" DataType="JSON" RequestType="Get" ContentType="application/json; charset=utf-8" />
                  </WebServiceDataSourceSettings>
              </DataSource>
              <Schema DataName="d"></Schema>
          </telerik:RadClientDataSource>

     

    OnCustomParameter Method

    1.function ParamMap(sender, args) {
    2.    if (RcbFun.get_value() != "") {
    3.        if (args.get_type() == "read" && args.get_data()) {
    4.              args.set_parameterFormat({ paramFunction: RcbFun.get_value() });
    5.        }
    6.   }
    7.}

     

    Loading items into RcbSubF after selecting the a value RcbFun for the first time is not a problem. The issues lies in selecting another value in RcbFun. The OnCustomParameter event "ParamMap" will not fire again. Any suggestion? 

    Please be advised that these controls are in side a RadPanelBar.

  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    985 posts

    Posted 23 Nov 2016 Link to this post

    Hello Raeshawn,

    In the described scenario the OnCustomParameter event does not fire again because all ComboBox items are retrieved with the initial request. Since subsequent requests on item selection are not sent to the server the event does not fire.

    Regards,
    Ivan Danchev
    Telerik by Progress
    Telerik UI for ASP.NET AJAX is ready for Visual Studio 2017 RC! Learn more.
Back to Top