0

I am using "Select2 Jquery" plugin. For the dropdown select form item, it searches in "Select" items and if it did not find any result, returns a value as below:

 $("#PROJECTID").select2({
        allowClear: true,
        minimumInputLength: 4,
        **formatNoMatches: function () { return "no such a value"; },**
    });

I am trying to show a partial view in the returning value. I am using ASP.net MVC framework. How can i call a action or show a partial view as a return value?

Regards.

4

1 回答 1

1

只需使用 jQueryload函数来调用返回部分视图的操作。

// select whatever container you plan to load the Partial View into
$('your selector').load(@Url.Action("YourAction", "YourController"));

如果您已经设置了返回部分视图的操作方法,那么这就是所有需要的。

于 2013-09-03T14:09:23.420 回答