简体   繁体   English

部分视图异步加载,未加载,无错误

[英]Partial View Asynchronous Loading , Not loading , No Errors

Vs'12 C# Asp.net MVC4, Internet Application Template + Kendo UI. Vs'12 C#Asp.net MVC4,互联网应用模板+ Kendo UI。

Description 描述

I'm coming from an KendoUI_DropDownList . 我来自KendoUI_DropDownList This fires an event that places the value of the selected item from the DDL into My Ajax Script . 这会触发一个事件,将DDL中所选项的值放入My Ajax Script This Script is passes the value "1" to my Contoller . 此脚本将值“1”传递给我的Contoller This controller starts my Partial View and is supposed to return it to my <div id="LoadingPartialDataDiv"></div> . 此控制器启动我的Partial View ,并应将其返回到我的<div id="LoadingPartialDataDiv"></div>

Code

  • My Div that i want the _PartialView to be placed in 我希望将_PartialView放入的Div

     <div id="LoadingPartialDataDiv"></div> 
  • Kendo DDL 剑道DDL

     @(Html.Kendo().DropDownList() .Name("OptionsDrop") .BindTo(new string[] { "Leasehold", "Owner", "Stranger" }) .Events(e => e.Change("change")) ) 
  • Script 脚本

     function change() { var val = $("#OptionsDrop").val(); $.ajax({ url: '/ImageView/Leasehold/', dataType: 'Post', data: { id : val }, success: function (data) { $('#LoadingPartialDataDiv').html(data); } }); }); 
  • Controller 调节器

     [HttpGet] public PartialViewResult LeaseholdA(string id) { int xx = Convert.ToInt16(id); var trct = db.Tracts.Find(xx); return PartialView("_Leasehold", trct); } 
  • View 视图

     @model OG.ModelData.dbTract Something Really Simple to test ViewBag.Title = @Model.TractNumber; 

Question

I receive absolutely no errors, I can even debug ( stepping through the code ) and see that it runs everything, without error. 我绝对没有收到任何错误,我甚至可以调试(单步调试代码)并看到它运行一切,没有错误。 My values are being passed from Script to Controller and From controller to the _partialView. 我的值从Script传递到Controller,从控制器传递到_partialView。 Yet my _partialView does not appear.... Any thoughts on this? 然而我的_partialView没有出现....对此有何看法?

probably is not this but did you notice: 可能不是这个,但你注意到了:

var val = $("#OptionsDrop").val();
data: { id : var }` **`<-- should be "val"

another thing I don't know much about those KendoUI controls but maybe you need to adds some scripts into your page. 另一件事我不太了解那些KendoUI控件,但也许你需要在页面中添加一些脚本。

Edit: try to add some code inside your partial view to check if Render is happening. 编辑:尝试在局部视图中添加一些代码以检查Render是否正在发生。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM