I have a table with each row as ascx. This control consists of an Ajax form, which includes cells that can have inputs. Here is the ascx:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<NerdDinner.Models.Dinner>" %>
<% using (Ajax.BeginForm("ViewAll", new AjaxOptions
{UpdateTargetId = "Dinner" + Model.DinnerID, InsertionMode = InsertionMode.InsertAfter, OnSuccess = "jsfunction"
})) {%>
<%= Html.Hidden("ID", Model.DinnerID)%>
<td><input type="submit" value="Save" /></td>
<td><strong>'<%=Model.Title%>'</strong></td>
<td><%=Model.EventDate.ToShortTimeString()%> on <%=Model.EventDate.ToShortDateString()%></td>
<td><%=Model.Address%></td>
<td><%= Html.TextBox("HostedBy", Model.HostedBy)%></td>
<td><%= Html.ActionLink("Edit", "Edit", new { id = Model.DinnerID })%></td>
<%} %>
After submitting, I will finish my processing and send the updated ascx to replace the existing one. However, this ascx is created a little differently than the original, which causes it to display incorrectly.
Here's what the original ascx looks like in FF:
<tr id="Dinner5">
<form onsubmit="Sys.Mvc.AsyncForm.handleSubmit(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.insertAfter, updateTargetId: 'Dinner5', onSuccess: Function.createDelegate(this, jsfunction) });" method="post" action="/NerdDinner/Dinners/ViewAll"/>
<input id="ID" type="hidden" value="5" name="ID"/>
<td>
</td>
<td>
</td>
<td>12:00 AM on 2/2/2010</td>
<td>ZSA2</td>
<td>
</td>
<td>
</td>
</tr>
Here's what the returned control looks like (ajaxContext.get_data ()):
<tr id="Dinner1">
<form onsubmit="Sys.Mvc.AsyncForm.handleSubmit(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, updateTargetId: 'Dinner1' });" method="post" action="/NerdDinner/Dinners/ViewAll">
<input id="ID" type="hidden" value="1" name="ID"/>
<td>
</td>
<td>
</td>
<td>12:00 AM on 1/1/2010</td>
<td>ZSA1</td>
<td class="red-back">
</td>
<td>
</td>
</form>
</tr>
Note that the latter does not contain any tds directly under tr, but the form covers all tds, and therefore nothing is displayed. In IE, I get the error message "htmlfile: Unknown runtime error" in MicrosoftAjax.js.
, - . . .