Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Passing Parameters from a View to a Controller in Asp.Net Core

$
0
0

I'm trying to pass multiple parameters from html in a view to a controller.

The controller definition is as follows:

public async Task<IActionResult> Index(string selectVisitor = "0" , string selectClass = "CB", string selectPaidStaff = "0", string sortType = " ")
-----------------------

The html in the view generated by scaffold is:

<li><a asp-area="" asp-controller="vAttendanceReports" asp-action="Index">Attendance Report - Visitors</a></li>
------------------------

I've figured out that I can manually use the url as follows to get the result I want:

http://localhost:63651/vAttendanceReports?selectVisitor=1&selectClass=CW

How can I code this in the view?  I've looked at url routing but I just get even more confused.

Thanks in advance,

Mark Lindahl


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>