返回的数据没有输出到我的文本框

本文关键字:我的 文本 输出 数据 返回 | 更新日期: 2023-09-27 18:15:32

                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;
                    },

返回的数据没有输出到我的文本框

在你的评论中,你说你得到一个异常,因为你超过了JavascriptSerializer.maxJsonLength属性的值。

请参阅msdn获取该属性的文档。

您可以在Web中更改该值。配置,但我建议检查是否有可能减少你发送的数据量,因为maxJsonLength默认为4MB,这应该是足够大的一个web应用程序,我认为:

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

编辑

对于你的第二个关于401 -未授权的问题:

当使用pagememethods时,你必须允许访问整个页面,据我所知。当您的页面包含其他方法或可用于身份验证用户的代码时,您可以将pagememethod移动到另一个页面或创建asmx webservice。

你可以编辑你的网页。配置在configuration下包含<location>标签:

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