Problem with Bootstrap Modal

1

Hello! My problem is this:

ThisbuttoncallsModalBootstrap:

<buttonclass="btn btn-default details" data-id="@item.nome"><i class="fas fa-street-view"></i></button>

This is the Modal Bootstrap page;

<div class="modal-dialog">
<div class="modal-content">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
        <h4 class="modal-title">Visitado em:</h4>
    </div>
    <div class="modal-body">
        <p>@Html.DisplayName("Nome")</p>
        <p>@Html.DisplayName("Data")</p>
        <p>@Html.DisplayName("Relatório")</p>
        <p>@Html.DisplayName("Cod Visita")</p>
        @foreach (var item in Model)
        {
            <p>@Html.DisplayFor(modelItem => item.nome)</p>
            <p>@Html.DisplayFor(modelItem => item.Fecha)</p>
            <p>@Html.DisplayFor(modelItem => item.Relatorio)</p>
            <p>@Html.DisplayFor(modelItem => item.id_visita)</p>
        }
    </div>
    <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Fechar</button>
    </div>
</div><!-- /.modal-content -->

This is my controller;

 DB_A3B4A6_estrangeirosEntities db2 = new DB_A3B4A6_estrangeirosEntities();
    public ActionResult IndexVisitas(string searchString)
    {
        var estrangeiros = from e in db2.Vw_RegistroVisita select e;
        if (!String.IsNullOrEmpty(searchString))
        {
            estrangeiros = estrangeiros.Where(s => s.nome.Contains(searchString));
        }

        return View(estrangeiros.ToList());
        //return View(db2.Vw_RegistroVisita.ToList());
    }

I apologize if it was not very clear or if more information was missing. I'm new to programming.

I need to make use of the variable.

    
asked by anonymous 01.06.2018 / 15:25

1 answer

1

First you should test if the value is correct in $(this).attr("data-id") , you can also test $(this).data("id") if your jQuery is greater than version 1.4.3

If it does not work, confirm the value coming from this part data-id="@item.nome"

    
01.06.2018 / 16:20