I want to pass a model to the controller after klicking on a row.
this is my code which doesn't work.
<table class="table">
<tr>
<th>
<p>Sender</p>
</th>
<th>
<p>Subject</p>
</th>
<th>
<p>Received</p>
</th>
<th>
<p>HasAttachment</p>
</th>
<th></th>
</tr>
@foreach (var item in Model.Inbox) {
<tr class="mail-row" onclick="location.href = '@(Html.ActionLink ("", "MailViewer", "Profile", new { mail = item }, null ))'">
<td>
@Html.DisplayFor(modelItem => item.Sender)
</td>
<td>
@Html.DisplayFor(modelItem => item.Subject)
</td>
<td>
@Html.DisplayFor(modelItem => item.Received)
</td>
<td>
@Html.DisplayFor(modelItem => item.HasAttachment)
</td>
</tr>
}
</table>
I tried to use Url.Action but i got only the Object Type in the url and not the actual object.
I try to send this object:
public class Mail
{
public string Sender { get; set; }
public string Subject { get; set; }
public DateTime Received { get; set; }
public bool HasAttachment { get; set; }
public string content { get; set; }
}
Url.Action. I would put all primitive types required for your object into yourUrl.Actionand serialize the object in your controller.