I need to send two objects to my controller using bindings but I have no idea how to do it. I just know how to send one object not multiple objects.
This is an example of how I'm doing it with a singular object.
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.master" Inherits="System.Web.Mvc.ViewPage<Inventario.Models.Report>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Create
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Create</h2>
<script src="<%: Url.Content("~/Scripts/jquery.validate.min.js") %>" type="text/javascript"></script>
<script src="<%: Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js") %>" type="text/javascript"></script>
<% using (Html.BeginForm()) { %>
<%: Html.ValidationSummary(true) %>
<fieldset>
<legend>Report</legend>
<div class="editor-label">
<%: Html.LabelFor(model => model.Client, "Client_1") %>
</div>
<div class="editor-field">
<%: Html.DropDownList("Client", String.Empty) %>
<%: Html.ValidationMessageFor(model => model.Client) %>
</div>
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
<% } %>
<div>
<%: Html.ActionLink("Back to List", "Index") %>
</div>
</asp:Content>
Then, It is received by the controller this way:
[HttpPost]
public ActionResult Create(Report report)
{
//Some code here
}
And what I need is to get two objects. IDK maybe something like this:
[HttpPost]
public ActionResult Create(Report report, AnotherObject ao)
{
//Some code here
}
I'm a beginer on this. Any guide you can give me will help me a lot. Thanks by advance.