Jump to content

Passar ID para modal


klasss

Recommended Posts

Boa tarde, 
estou a fazer um pequeno projeto em Asp.net MVC onde inicialmente abria uma nova view e com a seguinte função ia buscar o ID . 

 

function Editar(id)
    {
        window.location.href = "../Funcionario/Registo/" + id;
    }


Atualmente decidi mudar e em vez de abrir uma nova página quero que seja possível fazer o mesmo mas numa modal. Mas estou com dificuldades em encontrar a forma que funcione. 

Estou a usar o seguinte código para mostrar os dados e acrescentei um botão "Editar" 

 

 @{
                foreach (var item in (List<TarefasModel>)ViewBag.MostrarTarefas)
                {
                        <tr>
                            <td><button type="button" class="btn btn-warning" data-toggle="modal" data-target="#Modalpopup" onclick="IdModal(@item.Id)">Editar</button></td>
                            <td>@item.Id</td>
                            <td>@item.NomeTarefa</td>
                            <td>@item.Descricao</td>
                            <td>@item.Atribuido</td>
                            <td>@item.DataVencimento</td>
                            <td><button type="button" class="btn btn-success" onclick="Excluir(@item.Id)">Concluido</button></td>
                        </tr>

                }
            }


Agradeço a quem me puder dar umas dicas 

Abraço

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.