We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

drop down datamanager with parameters error


I've this page:

When I click on "Validar" button, I show a modal form, and this modal form has a drop downlist. When I click in any button the first time, I've get an error. After, works perfect.

My Javascript code:

 function onClick(args) {
        var grid = $("#gridPendientesValidar").ejGrid("instance");
        var index = this.element.closest("tr").index();
        var record = grid.getCurrentViewData()[index];

        $(".modal-body .hiddenId").val(record["ID"]);
        $(".modal-body .hiddenIdTipologia").val(record["IdTipologia"]);
        $(".modal-body .hiddenUserNameRemitente").val(record["RemitenteEnviado"]);

        var idTipologia = parseInt(record["IdTipologia"]);

        var dataManagerSubtipologias = ej.DataManager({
            url: baseUrl + "Notificaciones/GetSubtipologias",
            adaptor: new ej.UrlAdaptor(),           
            dataSource: dataManagerSubtipologias,
            query: new ej.Query().addParams("idTipologia", idTipologia),
            fields: { text: "Nombre", value: "IdSubtipologia" },



My controller code

 public JsonResult GetSubtipologias(int idTipologia)
            ////if (idTipologia == null)
            ////    return null;
            var datos = _repositorio.GetSubTipologias((int)idTipologia);
            return Json(datos);

If i set as parameter int? the first time not work