3

Vs'12 C# Asp.net MVC4, Internet Application Template + Kendo UI.

Description

I'm coming from an KendoUI_DropDownList. This fires an event that places the value of the selected item from the DDL into My Ajax Script. This Script is passes the value "1" to my Contoller. This controller starts my Partial View and is supposed to return it to my <div id="LoadingPartialDataDiv"></div>.

Code

  • My Div that i want the _PartialView to be placed in

    <div id="LoadingPartialDataDiv"></div>
    
  • Kendo 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. Yet my _partialView does not appear.... Any thoughts on this?

1 Answer 1

4

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.

Edit: try to add some code inside your partial view to check if Render is happening.

Sign up to request clarification or add additional context in comments.

3 Comments

yeah sorry that is a type of mine. In the code I'm actually passing it as an integer 1.
On the kendo and script side, all the code runs, as stated above. Its just simply not showing the _partialView
your ajaxcall is dataType: 'Post'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.