I've got a partial that is called by Ajax to add new line items. If I type in some data in the part ID field then click the link to Add another item, it wipes out what I just typed.
View:
<label>Parts Used
<%= Ajax.ActionLink("Add another item", "BlankEditor", new AjaxOptions {
UpdateTargetId = "partusageitems", InsertionMode = InsertionMode.InsertAfter}) %>
</label>
<div id="partusageitems">
<% foreach (var part in Model.PartUsage)
{
Html.RenderPartial("~/Views/Fsr/_PartsUsage.ascx", part);
}%>
</div>
Partial:
<div>
<% var fieldPrefix = "PartUsage[]."; %>
Part ID: <%= Html.TextBox(fieldPrefix + "ID", Model.ID, new { size = "25"})%>
Serial Number: <%= Html.TextBox(fieldPrefix + "Serial", Model.Serial, new { size = "25" })%>
Quantity: <%= Html.TextBox(fieldPrefix + "Quantity", Model.Quantity, new { size = "10"}) %>
<a href="#partsusagesection" onclick="deleteContainer(event)">Delete</a>
</div>
Controller:
public ActionResult BlankEditor()
{
return View("_PartsUsage", new Part());
}