Flexigrid中未从Web服务返回Json值 [英] Json value not returned from webservice in flexigrid

查看:66
本文介绍了Flexigrid中未从Web服务返回Json值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实现了followig Web方法(Notes.asmx文件):

I implemented the followig web method (file Notes.asmx):

[WebMethod(EnableSession = true)]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public object getNotesData ()
    {

        Guid contactId = new Guid("dc53b9a3-bde1-4810-88dd-3db2581f29b8");

        var data = BusinessObjectFactory.GetContactNotes(contactId);
        string serialized = new JavaScriptSerializer().Serialize(data);

        return serialized;
    }


该方法仅返回一些引用到联系人的数据.我单独测试了该方法,它正确返回了记录.

在aspx页面中,我使用以下Flexigrid语法调用此Web方法来检索数据:


The method simply return some data referred to a contact. I tested the method separately and it returns the records properly.

In an aspx page I use the following Flexigrid syntax to call this web method for retrieve the data:

$(function ()
        {
            $("#flex1").flexigrid(
            {
            url: 'WebService/Notes.asmx/getNotesData',
            dataType: 'json',
            colModel : [
            { display: 'NOTEID', name: 'NOTEID', width: 40, sortable: true, align: 'left' },
            { display: 'Title', name: 'Title', width: 150, sortable: true, align: 'left' }
            ],
            sortname: "Title",
            sortorder: "asc",
            usepager: true,
            title: "Notes_TITLE",
            useRp: true,
            rp: 10,
            showTableToggleBtn: false,
            resizable: false,
            width: 500,
            height: 370,
            singleSelect: true
            }
            );
       });



但是调试代码,我看到从flexigrid调用永远不会到达服务器.在浏览器中,aspx页面在Flexigrid UI中显示连接错误".

我使用通过Ajax/Json和jQuery调用的其他Web方法,它们可以正常工作.这不是一个错误的路径,因为aspx文件保存在同一服务器上,并且保存在包含Web服务的文件夹上方的目录中(称为WebService的文件夹).

为什么无法使用Flexigrid语法访问服务器?



However debugging the code I see that the server is never reached from the flexigrid call. In the browser the aspx page has a "Connection Error" in the Flexigrid UI.

I use other web methods invoked with Ajax/Json and jQuery and they work fine. It is not a matter of wrong path since the aspx file is saved on the same server and in the directory above the one containing the web service (folder called WebService).

Any suggestions why I cannot reach the server using Flexigrid syntax?

推荐答案

(函数() {
(function () {


(" ).flexigrid( { 网址:' WebService/Notes.asmx/getNotesData', dataType:' json', colModel:[ {display:' NOTEID',名称:' NOTEID',宽度: 40 ,可排序: true ,对齐:' 左'}, {display:' 标题',名称:' 标题',宽度: 150 ,可排序:> true ,对齐:' 左'} ], 排序名称:" , 排序顺序:" , usepager: true , 标题:" , useRp: true , rp: 10 , showTableToggleBtn: false , 可调整大小:错误, 宽度: 500 , 高度: 370 , singleSelect: true } ); });
("#flex1").flexigrid( { url: 'WebService/Notes.asmx/getNotesData', dataType: 'json', colModel : [ { display: 'NOTEID', name: 'NOTEID', width: 40, sortable: true, align: 'left' }, { display: 'Title', name: 'Title', width: 150, sortable: true, align: 'left' } ], sortname: "Title", sortorder: "asc", usepager: true, title: "Notes_TITLE", useRp: true, rp: 10, showTableToggleBtn: false, resizable: false, width: 500, height: 370, singleSelect: true } ); });



但是调试代码,我看到从flexigrid调用永远不会到达服务器.在浏览器中,aspx页面在Flexigrid UI中显示连接错误".

我使用通过Ajax/Json和jQuery调用的其他Web方法,它们可以正常工作.这不是一个错误的路径,因为aspx文件保存在同一服务器上,并且保存在包含Web服务的文件夹上方的目录中(称为WebService的文件夹).

为什么我无法使用Flexigrid语法访问服务器?



However debugging the code I see that the server is never reached from the flexigrid call. In the browser the aspx page has a "Connection Error" in the Flexigrid UI.

I use other web methods invoked with Ajax/Json and jQuery and they work fine. It is not a matter of wrong path since the aspx file is saved on the same server and in the directory above the one containing the web service (folder called WebService).

Any suggestions why I cannot reach the server using Flexigrid syntax?


这篇关于Flexigrid中未从Web服务返回Json值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆