jquery
  • asp.net-mvc-3
  • 2013-03-22 72 views 0 likes 
    0

    下面的代碼拋出錯誤,如「無法完成,由於操作錯誤80020101」的文件jquery-1.8.3.js四處錯誤:錯誤80020101

    <script language="javascript" type="text/javascript"> 
    
        $(document).ready(function() { 
         var Details = '@Url.Content("~/Controller/ActionResult1?id=")'; 
    
         var id= $("#id").val(); 
         $('#pager').hide(); 
    
         Details = Details + id; 
    
         alert(PropertyDetails); 
         $("#list").jqGrid({ 
    
          url: Details, 
          datatype: 'xml', 
          cache: false, 
          mtype: 'GET', 
          width: 600, 
          height: 234, 
          colNames: ['Name', 'Address', 'Type'], 
          colModel: [ 
          { name: 'Name', index: 'Name', width: 20, xmlmap: 'Name' }, 
          { name: 'Address', index: 'Address', width: 20, xmlmap: 'Address' }, 
          { name: 'Type', index: 'Type', width: 20, xmlmap: 'Type' }, 
          ], 
    
          xmlReader: { repeatitems: false }, 
          pager: '#pager', 
          rowNum: 10, 
          sortname: 'invid', 
          sortorder: 'desc', 
          viewrecords: true, 
          gridview: true, 
          loadonce: true, 
          shrinkToFit: true, 
          scroll: false, 
          altRows: true, 
          loadComplete: function() { 
           if ($('#list').getGridParam('records') > 10) { 
            $('#pager').show(); 
           } 
          } 
    
         }); 
    
        }); 
    
        </script> 
    
    <table id="list"><tr><td/></tr></table> 
    <div id="pager"></div> 
    
    my controller side. 
    
    public ActionResult ActionResult1(string id) 
         { 
    // code 
    } 
    

    回答

    1

    修改這樣的腳本:

    <script language="javascript" type="text/javascript"> 
    
        $(document).ready(function() { 
         var Details = '@Url.Content("~/Controller/ActionResult1?id='; 
    
         var id= $("#id").val(); 
         $('#pager').hide(); 
    
         Details = Details + id+'")'; 
    
    
         alert(PropertyDetails); 
         $("#list").jqGrid({ 
    
          url: Details, 
          datatype: 'xml', 
          cache: false, 
          mtype: 'GET', 
          width: 600, 
          height: 234, 
          colNames: ['Name', 'Address', 'Type'], 
          colModel: [ 
          { name: 'Name', index: 'Name', width: 20, xmlmap: 'Name' }, 
          { name: 'Address', index: 'Address', width: 20, xmlmap: 'Address' }, 
          { name: 'Type', index: 'Type', width: 20, xmlmap: 'Type' }, 
          ], 
    
          xmlReader: { repeatitems: false }, 
          pager: '#pager', 
          rowNum: 10, 
          sortname: 'invid', 
          sortorder: 'desc', 
          viewrecords: true, 
          gridview: true, 
          loadonce: true, 
          shrinkToFit: true, 
          scroll: false, 
          altRows: true, 
          loadComplete: function() { 
           if ($('#list').getGridParam('records') > 10) { 
            $('#pager').show(); 
           } 
          } 
    
         }); 
    
        }); 
    
        </script> 
    
    +0

    提供完整的代碼,我會給你+1。 – 2013-03-22 08:50:12

    +0

    我認爲sudarshan的代碼很好,除了我編輯的部分 – Sharun 2013-03-22 08:51:34

    +0

    是的,但是對於未來的搜索將是一個很好的答案。 – 2013-03-22 09:20:52

    相關問題