首页 新闻 会员 周边 捐助

ASP.NET MVC Web程序部署在IIS上的flexigrid插件路由问题

0
悬赏园豆:50 [已关闭问题] 关闭于 2011-05-23 10:20

    我在visual studio 2010开发环境下创建了一个Web项目,采用ASP.NET MVC架构,视图页面中使用了Jquery开发库的Flexigrid插件。在vs 2010下能够正确读取数据库并在页面中显示表格,然后将项目部署到windows 2003的IIS6.0上,在IIS的“默认网站”中创建了“SpeechWeb”目录,项目文件均在该目录中,在客户端浏览器输入地址“http://172.40.15.26/SpeechWeb/default.aspx”能够正确运行相关网页,网页上的Flexigrid插件能够运行,但是却不能路由进入Speakerlib Controller的GetSpeakerList Action方法中进行数据操作,因此视图页面显示“无法获取数据”的错误提示,表格中没有显示任何数据。

    在该页面的Javascript代码中调用了$.ajax({url: "<%=Url.Action("GetSpeakerList","Speakerlib")%>"}),能够正确进入Speakerlib Controller的GetSpeakerList Action中。

    不知道$("#speakerlist").flexigrid(option)和 $.ajax()在参数url的设置上有什么区别吗?还是其他什么原因造成flexigrid无法路由到controller的Action方法?

    调用$("#speakerlist").flexigrid(option)的代码如下:

$(document).ready(function () {

           var option = {

               height: gh, //flexigrid插件的高度单位为apx

               width: w,

               url: "<%=Url.Action("GetSpeakerList","Speakerlib")%>", //ajax url,ajax方式对应的url地址

               colModel: [

                                        { display: '编码', name: 'SpeakerID', width: 60, sortable: true, align: 'left' },

                                        { display: '姓名', name: 'Name', width: 100, sortable: true, align: 'left' },

                                        { display: '年龄', name: 'Age', width: 100, sortable: true, align: 'left' },

                                        { display: '性别', name: 'Gender', width: 100, sortable: true, align: 'left' },

                                        { display: '国籍', name: 'State', width: 100, sortable: true, align: 'left' },

                                        { display: '创建时间', name: 'CreateTime', width: 100, sortable: true, align: 'left' },

                                        { display: '状态', name: 'Status', width: 100, sortable: true, align: 'left', process: formatStatus }

                                         ],

               buttons: [

                      { name: 'Add', displayname: "新增基本信息", bclass: 'Add', onpress: call },

               //{ name: 'Edit', displayname: "编辑-", bclass: 'Edit', onpress: call },

                      {name: 'Delete', displayname: "删除", bclass: 'Delete', onpress: call }

                    ],

               searchitems: [

                                    { display: '编码', name: 'SpeakerId', isdefault: true, operater: "Eq", reg: /^[\d]+$/ },

                                    { display: '姓名', name: 'Name', operater: "Like" }

                                    ],

               sortname: "CreateTime",

               sortorder: "desc",

               usepager: true,

               useRp: true,

               rowbinddata: true,

               showcheckbox: false

           };

           var grid = $("#speakerlist").flexigrid(option);

       });

    调用$.ajax()的代码如下:

       function del(pid) {

           jConfirm("确删除编码为"+pid+"的所有记录?", "选择", function (r) {

               if (r) {

                   var parm = { Id: pid };

                   $.ajax({

                       type: "POST",

                       url: "<%=Url.Action("GetSpeakerList","Speakerlib")%>",

                       data: $.param(parm),

                       success: function (msg) {

                           $("#speakerlist").flexReload({});

                           jAlert("删除成功", "确定");

                       }

                   });

               }

           });

       }

问题补充: 我在IIS配置中已经没有扩展名的 Web 地址都被映射到 aspnet_isapi.dll 服务器扩展上
干一行恨一行的主页 干一行恨一行 | 初学一级 | 园豆:200
提问于:2011-04-21 14:21
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册