2011-11-24 23 views
-2
   lstNominalAccounts = NominalAccount.FindUserNominalAccounts(
        basePage.CurrentSageDatabase, 
        searchText, 
        basePage.CurrentUser.UserID); 

       foreach (NominalAccount oNominal in lstNominalAccounts) 
       { 
        strBuilder.Append(oNominal.AccountName + " " + oNominal.AccountNumber + " " + oNominal.CostCentre + " " + oNominal.Department + ":"); 
       } 
       strBuilder = strBuilder.Remove(strBuilder.Length -1,1); 

       return strBuilder.ToString(); 



//When i hover over the returned strBuilder it shows the record that ive typed in for //autocomplete but it wont output to my textbox(#tbNominalAccounts) 


//this is my success statement on my ajax autocomplete if that helps also 

success: function (data) { 
         var datafromServer = data.d.split(":"); 
         source: datafromServer; 
        }, 
+0

你必須表現出更多的信息。你是否檢查過提琴手通過電線傳輸的東西?所以你看到任何JavaScript錯誤?任何.NET異常? – Jan

+0

沒有javascript錯誤!它發佈在搜索文本中鍵入的值,但是沒有響應 –

+0

「使用JSON JavaScriptSerializer進行序列化或反序列化期間出現錯誤,字符串的長度超過了maxJsonLength屬性中設置的值。 –

回答

0

在您的評論中,您說因爲超出JavascriptSerializer.maxJsonLength屬性的值而得到例外。

查看msdn該文件的財產。

您可以在您的Web.config中更改該值,但我建議您檢查是否有可能減少您發送的數據量,因爲maxJsonLength默認爲4MB,對於我認爲應該足夠大的Web應用程序:

<configuration> 
    <system.web.extensions> 
     <scripting> 
      <webServices> 
       <jsonSerialization maxJsonLength="50000000"/> 
      </webServices> 
     </scripting> 
    </system.web.extensions> 
</configuration> 

編輯

你的第二個問題,關於401 - 未經授權:

當使用pagemethods你必須允許訪問TH據我所知,整個頁面。 當您的頁面包含可用於驗證用戶的其他方法或代碼時,可以將pagemethod移動到另一個頁面或創建asmx webservice。

您可以編輯你的web.config包括configuration<location>標籤:

<location path="Datenschutz.aspx"> 
    <system.web> 
    <authorization> 
     <allow users="?" /> 
    </authorization> 
    </system.web> 
</location> 
+0

耶已經做到了,但謝謝!我現在有另一個問題'401未經授權'上發佈方法'GetUserNominalAccounts'你知道我怎麼可以允許匿名訪問? –

+0

取決於您使用的框架。 MVC? Web表單?還有別的嗎?你如何授權你的用戶?你在哪個上下文中調用你所顯示的代碼(MVC動作,靜態頁面方法,webserice)? – Jan

+0

.net framework 3.5,asp.net webforms,我打電話給一個靜態頁面方法,不知道我們如何授權我們的用戶我沒有設計我們的應用程序 –

相關問題