2015-09-16 75 views
0

序列化期間出錯或deserialization使用JSONJavaScriptSerializer。字符串的長度超過了在maxJsonLength屬性中設置的值。字符串的長度超過maxJsonLength屬性中設置的值

<script type="text/javascript"> 
    function pageLoad(sender, e) { 
    var Indexproductgroup = $get('<%=cboproductgroup.ClientID %>').selectedIndex; 
    var Selectedproductgroup = $get('<%=cboproductgroup.ClientID %>').options[Indexproductgroup].value; 

    var q = $find("autoCompleteBehavior2"); 
    q.add_populating(function() { 
     q.set_contextKey(Selectedproductgroup); 
    }); 
    } 
</script> 

回答

0

在您的web.config中,您必須將maxJsonLength屬性設置爲更高的值。

<configuration> 
    <system.web.extensions> 
     <scripting> 
      <webServices> 
       <jsonSerialization maxJsonLength="2147483644"/> 
      </webServices> 
     </scripting> 
    </system.web.extensions> 
</configuration> 
+0

我已經試過了,但我得到了同樣的錯誤....... – Vigneshganesh

+0

在Page_Load(代碼背後沒有在JavaScript),你可以嘗試覆蓋JavascriptSerializer類,像這樣的MaxJsonLength: JavaScriptSerializer serializer = new JavaScriptSerializer(); serializer.MaxJsonLength = Int32.MaxValue; –

+0

我試過這個昏暗的序列化器作爲新的JavaScriptSerializer() serializer.MaxJsonLength = Int32.MaxValue但同樣的錯誤發生..... – Vigneshganesh

相關問題