I am trying to pass the value stored in a buttons "value property" to my controller when the button is clicked. I am new to asp.net mvc and I am not sure what the best method is to accomplish this task. I tried looking around the forums but didn't find anything that was clear enough. I don't just want the answer, I want to be able to understand it. Appreciate any tips/hints/etc. Below is the code for my button:

<div class="jumbotronAll">

    @foreach (var item in Model)
    {   

        @Html.Raw("<br />")
        Html.BeginForm("Index", "AllTracks");
        {
            <input type="button" value='@item.collegeOf' class="AllTracksButtons" onclick="location.href='@Url.Action("ListTracksByMajor", "AllTracks", new { college = item.collegeOf })'" />
        }
        @Html.Raw("<br />")
    }
</div>

Related posts

Recent Viewed