2017-07-14 142 views
0

我正在使用Jqgrid进行与asp.net的内联编辑并使用handler.ashx文件来存储网格中的值。它在VS中工作得非常好,但是当我在iis上发布并运行它时,会导致错误。Jqgrid内联错误处理程序文件与asp.net一起使用时未找到

以下是jqGrid的

$("#grid-table-Labor").jqGrid({ 
        url: 'LaborApproval.aspx/GetLaborData', //asp function to get all data from data base to grid 
        data: "{}", 
        datatype: 'json', 
        mtype: 'POST', 
        serializeGridData: function (postData) { 
         return JSON.stringify(postData); 
        }, 
        ajaxGridOptions: { contentType: "application/json" }, 
        loadonce: true, 
        colNames: [' ', 'Employee Code', 'Name', 'Contractor', 'DOJ', 'Police Verification', 'Gate Pass Valid Upto', 'Status', 'Remark'], 
        colModel: [ 
            { 
             name: 'myac', index: 'myac', width: 80, fixed: true, sortable: false, resize: false, formatter: 'actions', 
             formatoptions: { 
              keys: true, 
              delbutton: false, 
              editOptions: {}, 
              addOptions: {}, 
              delOptions: {} 
             } 
            }, 
            { name: 'EMPCODE', index: 'EMPCODE', width: 108, key: true }, 
            { name: 'NAME', index: 'NAME', width: 140 }, 
            { name: 'CONTNAME', index: 'CONTNAME', width: 160 }, 
            { name: 'DOJ', index: 'DOJ', width: 70, formatter: 'date', formatoptions: { newformat: 'd-m-y' } }, 
            { name: 'POLICE_VRIFICATION', index: 'POLICE_VRIFICATION', width: 124 }, 
            { name: 'GatePassValidUpto', index: 'GatePassValidUpto', editable: true, sorttype: "date", unformat: pickDate }, 
            { name: 'Approve', index: 'Approve', width: 148, editable: true, edittype: "select", editoptions: { value: "True:Approve;False:Rejected" } }, 
            { name: 'REMARK', index: 'REMARK', width: 150, sortable: false, editable: true, edittype: "textarea", editoptions: { rows: "2", cols: "10" } } 
        ], 
        pager: '#grid-pager-Labor', 
        altRows: true, 
        //cacheUrlData: true, 
        //toppager: true, 
        rowNum: 10, 
        scrollOffset: 0, // to remove offset of scroll bar for imporved gui 
        rowList: [10, 50, 100, 200, 300, 500, 800, 1000, 1500], 
        //onSelectRow: editRow, 
        viewrecords: true, 
        emptyrecords: "Nothing to display", 
        //multiselect: true, 
        //multiboxonly: false, 
        gridview: true, 
        loadComplete: function() { 
         var table = this; 
         setTimeout(function() { 
          //styleCheckbox(table); 
          //updateActionIcons(table); 
          updatePagerIcons(table); 
          enableTooltips(table); 
         }, 0); 
        }, 
        jsonReader: { 
         page: function (obj) { return 1; }, 
         total: function (obj) { return 1; }, 
         records: function (obj) { return obj.d.length; }, 
         root: function (obj) { return obj.d; }, 
         repeatitems: false, 
         id: "0" 
        },      
        editurl: 'Handler/JQGridHandler.ashx', 
        caption: 'Labor List', 
        shrinkToFit: true, 
        height: 'auto', 
        //autowidth: true, 
        xmlReader: { 
         root: "list", 
         row: "Response", 
         id: "cfgId", 
         repeatitems: false 
        }, 
        beforeSelectRow: function (rowid, e) { 

         var iCol = $.jgrid.getCellIndex($(e.target).closest("td")[0]); 
         if (this.p.colModel[iCol].name === 'EMPCODE') {              
          var param = { param: rowid }; 

          console.log(rowid); 
          $.ajax({ 
           url: "LaborApproval.aspx/ShowMe",         
           data: JSON.stringify(param), 
           dataType: "json", 
           type: "POST", 
           contentType: "application/json; charset=utf-8",       
           success: function (data) { 
            console.log(data);                    
              var box = bootbox.dialog({ 
                show: true, 
                message: data['d'], 
                title: "Labour Details", 
                buttons: { 
                 ok: { 
                  label: "OK", 
                  className: "btn-primary", 
                  callback: function() { 
                   console.log('OK Button'); 
                  } 
                 }         
                } 
              }); 
              box.modal('show'); 
             }, 
           error: function (XMLHttpRequest, textStatus, errorThrown) { 
            var err = eval("(" + XMLHttpRequest.responseText + ")"); 
            alert(err.Message) 
            // console.log("Ajax Error!"); 
           } 
          }); 

          return false; 
         } 
        } 
       }); 

的代码,以下是错误

[HttpException]: The file '/CMS/Web_Pages/HR_Pages/Handler/JQGridHandler.ashx' does not exist. 

    at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) 

    at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) 

    at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean ensureIsUpToDate) 

    at System.Web.UI.SimpleHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) 

    at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 

    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) 

--> 
+0

之前是否该文件存在于你的IIS? – mjwills

+0

是的,它在处理程序文件夹中有效 –

+0

@Lord_of_Lucifer文件的名称是什么? – mjwills

回答

0

我不得不把

editurl: '../../Handler/JQGridHandler.ashx', 

链接

相关问题