DropDownList actionComplete not firing

Hi,

I want to evaluate text in dropdownlist and disabled another dropdownlist according to that value, but it seems that the actionComplete event is not fired.

The dropdown definition:
@Html.EJ().DropDownListFor(model => model.IdRolTipo).Datasource((IEnumerable<Navicare.WebUI.Models.RolTipoUI>)Navicare.WebUI.Helpers.LlenaCombos.RolTipo()).ClientSideEvents(e => { e.Change("change"); e.ActionComplete("verificaRol"); }).DropDownListFields(Df => Df.Text("TipoRol").Value("IdTipoRol"))

The dropdown I want to disable or enable according to the firstone:
@Html.EJ().DropDownListFor(model => model.NotificacionFacturacion).Datasource((IEnumerable<Navicare.WebUI.Helpers.ComboGenerico>)Navicare.WebUI.Helpers.LlenaCombos.OpcionesSiNo()).DropDownListFields(Df => Df.Text("Text").Value("Id"))

The scripts:
function verificaRol() {
alert("verificado");
var drpRol = $("#IdRolTipo").ejDropDownList("instance");
        if (drpRol.selectedTextValue.indexOf("artera") !== -1 || drpRol.selectedTextValue.indexOf("ARTERA") !== -1) {
var drpNotificacion = $("#NotificacionFacturacion").data("ejDropDownList");
            drpNotificacion.disable();
}
}


3 Replies

KR Keerthana Rajendran Syncfusion Team March 6, 2018 08:39 AM UTC

Hi Juan,   
   
Thank you for contacting Syncfusion Support.   
   
ActionComplete event of DropDownList will be triggered in case of remote dataSource bound through dataManager. It seems you are binding local data for DropDownList and here you can use dataBound event of DropDownList, which will be triggered once dataSource is bound to DropDownList. Please refer to the below code   
   
  <div class="frame">   
        <h3 style="margin-left:20px;"></h3>   
        <br />   
        <div class="control" style="floatleft;">   
            <span class="txt">Select Group</span>   
            @Html.EJ().DropDownListFor(model => model.IdRolTipo).Datasource((IEnumerable<groups>)ViewBag.datasource).DropDownListFields(f => f.Value("parentId").Text("text")).SelectedIndex(2).ClientSideEvents(e=>e.Change("onchange").DataBound("verificaRol"))   
        </div>   
        <div class="control" style="floatleft;">   
            <span class="txt">Select Country</span>   
            @Html.EJ().DropDownListFor(model => model.NotificacionFacturacion).Datasource((IEnumerable<Countries>)ViewBag.datasource1)   
    </div>   
        </div>   
<script>   
    window.setTimeout(function verificaRol(args) {   
        alert("verificado");   
        var drpRol = $("#IdRolTipo").ejDropDownList("instance");   
        if (drpRol.selectedIndex() == 2) {   
            var drpNotificacion = $("#NotificacionFacturacion").ejDropDownList("instance");   
            drpNotificacion.disable();   
        }   
    }, 50);   
     
</script>   
   
Note: We have included setTimeout to execute this method once the second dropdown has been rendered.   
   
We have attached a sample for your reference which can be downloaded from the following link   
   
   
Regards   
Keerthana.  



JJ Juan Jose Uribe March 6, 2018 07:57 PM UTC

Thankyou very much. It's working now as I wanted.

Kind regards, 

Juan J.


KR Keerthana Rajendran Syncfusion Team March 7, 2018 04:18 AM UTC

Hi Juan, 
 
Most Welcome. Please get back to us if you require further assistance on this. We will be happy to assist you. 
 
Regards, 
Keerthana. 


Loader.
Up arrow icon