且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在MVC 5剃须刀中调用和刷新局部视图?

更新时间:2023-02-14 19:13:42

我最终在后面的代码中使用了一些称为Ajax的代码,该代码从下拉列表中读取了点击.获取所选项目的值,并将值传递回

I ended up using some called Ajax in the code behind that reads the click from the dropdown list. get the value of the selected item and passed the values back to

后面的所有控制器代码均用于构建列表,并将其发送以更新部分视图,如果有数据,它将通过部分视图

all of the controller code behind to build the list and send it to update the partial view and if there is data there it pass the partial view

,其中包含创建表单的更新列表.

with the update list to the create form.

    $(document).ready(function () {
        $('#RES_VID').change(function ()
        {

            debugger;

            $.ajax(

                {
                    url: '@Url.Action("UpdatePartialViewList")',
                    type: 'GET',
                    data: { VID: $('#RES_VID').val() },

                    success: function (partialView)
                    {
                        $('#PV_WidgetList').html(partialView);
                        $('#PV_WidgetList').show();
                    }
                });