Can not read property 'toUpperCase' of undefined

0

good day!

Previously my page worked correctly but yesterday when doing some tests I started to mark this error in the file select2.min.js which is strange because I do not modify anything.

When I display a select it is when I start to mark the mentioned error but if I look for a particular state as it is shown, it does not mark the error.

With this code full select

<div class="col-md-6">
        <div id="dropCN" style="display:none;">
            <h2>Selecciona el centro de negocios</h2>
            <div class="form-group form-group-default" style="width:400px;">
                <label class="">CN</label>
                <select id="select_cn" data-placeholder="Select Country" class="full-width" data-init-plugin="select2" style="width:350px;">
                    <!--onchange="SeleccionarCN(this.value);"-->
                    <optgroup label="TU CN ASIGNADO ACTUALMENTE">
                        <option value="@cn_pedido.SALESREP_ID">@cn_pedido.RESOURCE_NAME</option>
                    </optgroup>
                    @foreach (IGrouping<String, MiVianney.Models.CN> estados in ViewBag.Estados)
                    {
                        <optgroup label="@estados.Key">
                            @foreach (var cn in estados)
                            {
                                <option value="@cn.SALESREP_ID">@cn.RESOURCE_NAME</option>
                            }
                        </optgroup>
                    }
                </select>
            </div>
        </div>
    </div>

And in the controller I have this

List<CN> lista_CN = ManejoDatos.wsObtenerCN(1);
            //LISTA CN 
            ViewBag.CN = lista_CN;
            //CN AGRUPADOS POR ESTADOS
            ViewBag.Estados = from estados in lista_CN group estados by estados.ESTADO;

Does anyone know what may be happening?

    
asked by Amairani Fernanda 21.11.2018 в 16:12
source

1 answer

0

Try removing the null items from the list, as suggested in the comments, or try to control this by replacing string .

For now, from c #, the only thing that occurs to me is that you apply what I told you to the list.

lista_CN.RemoveAll(item => item == null);
    
answered by 21.11.2018 в 16:51