0

In my Asp.net MVC 2.0 web Application. I am using an Ajax form . After the Sucessful Ajax ,

I am mentioning update target ID to update content of page with out completely refreshing it.

In my View:

 <% using (Ajax.BeginForm("AjaxAdd", "Home", new AjaxOptions { OnSuccess = "Success", OnFailure = "Failed",UpdateTargetId = "VLD_EMP_ChangedOn"}))
                   { %>

           <%=Html.HiddenFor(Model => Model.CreatedOn)%>
           <%:Html.DisplayFor(Model => Model.CreatedOn)%>

I am returning a string from my controller to view to update CreatedOn with new value.

But, i was getting an Unknown runtime error

In MicrosoftMVCAjax.Debug.JS :

If (target) {
        switch (insertionMode) {
            case Sys.Mvc.InsertionMode.replace:
                target.innerHTML = content;  ==> Error Here
                break;
            case Sys.Mvc.InsertionMode.insertBefore:
                if (content && content.length > 0) {
                    target.innerHTML = content + target.innerHTML.trimStart();
                }
                break;
            case Sys.Mvc.InsertionMode.insertAfter:
                if (content && content.length > 0) {
                    target.innerHTML = target.innerHTML.trimEnd() + content;
                }
                break;
        }

The target i am getting is: CreatedOn

The Content is also not null and i am getting appropriate value.

But, it was still saying unknown runtime error

First of all I doubt, is it the right way to update an hidded content ?

If not..Please Specify appropriate way of doing it.

Sai Avinash
  • 4,523
  • 16
  • 50
  • 93

0 Answers0