trying to pass two values of the row the user clicked to my action

trying to pass two values of the row the user clicked to my action

henry99henry99 Posts: 1Questions: 1Answers: 0

I never really used datatable and maybe this is a simple question, but i couldn't really find anything on the internet to answer my doubts properly, so first of all, i want to know if it's possible to pass 2 values that i have in the row after the user clicks the button of that row, i want to pass those two values as parameters to my action.

So with only one parameter, that's how i do it, and it works just fine

View:

"data": "GroupID", "render": function (data) { return "<a class='bntModelSu cursor' style='color: white; font-size: 12px' href=/Relatorio/Acessos/AcessosPorGrupo/AcessosPorGrupoUsuario/" + data + ">Edit</a>";

Action:

[Route("Relatorio/Acessos/AcessosPorGrupo/AcessosPorGrupoUsuario/{GroupID?}")] public IActionResult ListarAcessosGrupoUsuario(int? grupoID)

With this i can get the groupID of the row that the user clicked and pass to my action, and this is my problem, i want to get the groupID and also the groupName and pass those values to my action when the user clicks, how would i do that?

Never used datatable so any help is appreciated, I'm using ASP.NET Core, C#.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,309Questions: 26Answers: 4,948
    edited February 2019 Answer ✓

    The columns.render function has more parameters than data. You can use the row parameter to access other elements within the row.
    "render": function (data, type, row )

    You would access the row data using row.groupName and place that in the URL string.

    Kevin

This discussion has been closed.