Reputation: 1
I am working on an asp.net mvc web application, and i have the following main view:-
<div class="box-content">
@using (Ajax.BeginForm("AssignCustomer", "Firewall", new AjaxOptions
{
InsertionMode = InsertionMode.InsertAfter,
UpdateTargetId = "Customertable",
LoadingElementId = "progress",
HttpMethod= "POST",
OnSuccess="submitform"
}))
{
@Html.ValidationSummary(true)
@Html.AntiForgeryToken()
@Html.HiddenFor(model=>model.FirewallCustomer.ID)
<div>
<span class="f">Customer Name</span>
@Html.TextBoxFor(model => model.FirewallCustomer.CustomerName, new { data_autocomplete_source = Url.Action("CustomerAutoComplete", "Firewall") })
@Html.ValidationMessageFor(model => model.FirewallCustomer.CustomerName)
</div>
<input type="submit" value="Save" class="btn btn-primary"/>
}
<p><img src="~/Content/Ajax-loader-bar.gif" class="loadingimage" id="progress" /></p>
<table class="table table-striped table-bordered bootstrap-datatable datatable">
<thead>
<tr>
<th class="f"> Customer Name </th>
</tr></thead>
<tbody id="Customertable">
@foreach(var info in Model.Firewall.FirewallCustomers.OrderBy(a=>a.CustomerName)){
<tr id= "@info.CustomerName">
<td> @Html.ActionLink(info.CustomerName, "Index", "Customer", new {searchTerm=info.CustomerName},null)</td>
<td></td>
</tr>
}
</tbody>
</table> </div></div></div>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
which calls the following action method when submitting the Ajax.begin form:-
[HttpPost]
[ValidateAntiForgeryToken]
[CheckUserPermissions(Action = "Edit", Model = "Firewall")]
public ActionResult AssignCustomer([Bind(Include = "FirewallCustomer")] FirewallJoin fc)
{
fc.FirewallCustomer.CustomerName = fc.FirewallCustomer.CustomerName.Trim();
if (ModelState.IsValid)
{
try
{
repository.InsertOrUpdateFirewallCustomer(fc.FirewallCustomer,ADusername);
repository.Save();
return View("_customerrow", fc.FirewallCustomer);
and the returned partial view from the action method call, (which should be inserted after the table body) looks as follow:-
@model TMS.Models.FirewallCustomer
<tr id="@Model.CustomerName.ToString()">
<td>@Model.CustomerName</td>
<td>
@Ajax.ActionLink("Delete",
"DeleteCustomerFirewall", "Firewall",
new { firewallid = Model.ID, customername = Model.CustomerName},
new AjaxOptions
{ Confirm = "Are You sure You want to delete " + Model.CustomerName,
HttpMethod = "Post",
OnSuccess = "deletionconfirmation",
OnFailure = "deletionerror"
})
</td>
</tr>
now when i click on the ajax.beginform insdie my main view the record will be added to the DB, but the partial view will not returned , instead i will get the folloiwng exception :-
0x80020101 - JavaScript runtime error: Could not complete the operation due to error 80020101.
And the the jquery 1.8.2 will throw an exception (throw e) on the following code:-
if ( !transport ) {
done( -1, "No Transport" );
} else {
jqXHR.readyState = 1;
// Send global event
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
}
// Timeout
if ( s.async && s.timeout > 0 ) {
timeoutTimer = setTimeout( function(){
jqXHR.abort( "timeout" );
}, s.timeout );
}
try {
state = 1;
transport.send( requestHeaders, done );
} catch (e) {
// Propagate exception as error if not done
if ( state < 2 ) {
done( -1, e );
// Simply rethrow otherwise
} else {
throw e;
}
}
Can anyone adivce what is causing this problem ?
Upvotes: 0
Views: 5132
Reputation: 6786
All the error 80020101 means is that there was an error, of some sort, while evaluating JavaScript. If you load that JavaScript via Ajax, the evaluation process is particularly strict.
Sometimes removing // will fix the issue, but the inverse is not true... the issue is not always caused by //.
Look at the exact JavaScript being returned by your Ajax call and look for any issues in that script. For more details see a great writeup here
http://mattwhite.me/blog/2010/4/21/tracking-down-error-80020101-in-internet-exploder.html
Upvotes: 2