尽管视图模型已更新,但POST后视图未更新

时间:2019-03-08 07:13:54

标签: asp.net razor model-view-controller

我正在编写ASP.NET自定义组件,我想使用以下代码更新视图:

 @if (Model.TableDatasource != null){
                    //Write some thing to html page example: tables or span

}

首先, Model.TableDatasource 为空,用户选择信息,然后执行Controller Review View(Model),如下所示:

var model = new PrintDeliveryTicketModel()
            {
                PlantList = CommonHelper.GetPlantList(),
            };

            if (request == null)
            {
                return View(model);
            }
            else
            {
                var currentPlant = JsonConvert.DeserializeObject<PlantList>(request);

                var FullModel = new PrintDeliveryTicketModel()
                {
                    PlantList = CommonHelper.GetPlantList(),
                    CurrentPlant = JsonConvert.DeserializeObject<PlantList>(request),
                    DriverList = JsonConvert.DeserializeObject<List<Drivers>>(CommonHelper.GetDriver(currentPlant.CodePlant, currentPlant.PlantNo.Value).Content.ReadAsStringAsync().Result),
                    CustomerList = JsonConvert.DeserializeObject<List<Customer>>(CommonHelper.GetCustomer().Content.ReadAsStringAsync().Result),
                    RecipeList = JsonConvert.DeserializeObject<List<Recipe>>(CommonHelper.GetRecipe(currentPlant.CodePlant, currentPlant.PlantNo.Value).Content.ReadAsStringAsync().Result),
                    SitesList = JsonConvert.DeserializeObject<List<Site>>(CommonHelper.GetSite().Content.ReadAsStringAsync().Result),
                   // TruckList = JsonConvert.DeserializeObject<List<Truck>>(CommonHelper.GetTruck().Content.ReadAsStringAsync().Result)
                };

                return View(FullModel);

            }

在调试时,我注意到断点在返回 View(FullMode)处停止,而ViewFile(cshtml)的断点具有价值。但看不到任何内容。

希望有所帮助。

0 个答案:

没有答案