Mr. Newbie
Mr. Newbie

Reputation: 412

How to render a gridview in the view using Asp.Net C# MVC 4 Razor Devexpress.

I have an application and I want to update the view when the success event fires. Thanks.

Controller C#

    public ActionResult Oid(int Oid)
    {
        CustomerId = Oid;
        var model = ordendao.CustomerOrder(Oid);
        return PartialView("_TreeListOrdenesPartial", model);
    }

returns a html response

Javascript code

function event(){

    $.ajax({
            url: '@Url.Action("Oid","Customer")',
            data: JSON.stringify({ "Oid": customer[0]}),
            type: 'POST',
            contentType: 'application/json; charset=utf-8',
            success: function (data) {
                // return values 
                console.log("Sucess!" + data.oid);
            },
            error: function () { console.log('error!!'); }
          });
   }

Upvotes: 0

Views: 1819

Answers (1)

Jonesopolis
Jonesopolis

Reputation: 25370

make a placeholder on your page, where you want the partialview to render:

<div id="treeListPartial"></div>

then in your ajax:

success: function (data) {
    $("#treeListPartial").html(data);
},

Upvotes: 3

Related Questions