【问题标题】:How to render a gridview in the view using Asp.Net C# MVC 4 Razor Devexpress.如何使用 Asp.Net C# MVC 4 Razor Devexpress 在视图中呈现网格视图。
【发布时间】:2014-05-16 16:57:47
【问题描述】:

我有一个应用程序,我想在success 事件触发时更新视图。 谢谢。

控制器 C#

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

返回一个 html 响应

Javascript 代码

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!!'); }
          });
   }

【问题讨论】:

    标签: c# asp.net-mvc-4 razor devexpress-mvc


    【解决方案1】:

    在页面上创建一个占位符,您希望在其中呈现局部视图:

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

    然后在你的 ajax 中:

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

    【讨论】:

    • 谢谢! @Jonesy 我只是同意选择器 $
    猜你喜欢
    • 1970-01-01
    • 2019-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-11
    • 1970-01-01
    • 2012-03-03
    • 2010-11-22
    相关资源
    最近更新 更多