开发者

ASP.NET MVC 2, Ajax.ActionLink resets form data

As I have an editor-list, that needs to have additional edit lines, I found this solution for the problem:

Mvc list editor by Stevens Anderson

this works 开发者_开发知识库perfectly, excepts that every time when I add a new line, the whole Form is set back to the default values. You can see the behavior in the demo of the linked page. Try to edit the value of an input box and then add a new line without saving.

Why isn't it possible just to add a new editor line, without changing any data.


Ok, I've found a workaround

Instead of using the Html.AjaxLink I am now using a custom JavaScript function with jQuery

    function newProjectExpenseRow() {
      jQuery.get("/Controller/Action", function (response) {
          $(response).insertBefore("#id");
      });         
    }

it now gets the Control from the controller/action and inserts the result before the #id element

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜