Problem with Modal Bootstrap

Asked

Viewed 48 times

1

Hello! My problem is this: inserir a descrição da imagem aqui

This is the button that calls the Modal Bootstrap:

<button class="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 am new to programming.

I need to make it work using the variable.

1 answer

1


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

if it doesn’t work check the value that is coming in this part data-id="@item.nome"

  • That’s right, I changed it to $(this). date("id") . Thank you!

  • @Dpwsreceptive does not forget brand as answered :)

  • Where do you mark "Answered"?

  • on the left side of the answer, below the dots has a checkin image, so clikar on it :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.