Ajax绑定选择(组合框)错误(或列表为空,具体取决于浏览器) [英] Ajax bound select (combo box) error (or list is empty depending on browser)

查看:75
本文介绍了Ajax绑定选择(组合框)错误(或列表为空,具体取决于浏览器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我接管了一个项目,该项目的页面可以加载1,430个条目的大型选择(组合框)列表,并且可以在我们的主页上毫无问题地加载.我们正在使用漂亮的照片 [

I took over a project where I have a page that loads a large select (combo box) list of 1,430 entries and loads without issue on our main page. We are using Pretty Photo[^] as a modal display for inserting and modifying data. (I removed the pretty photo and the issue persisted 4/4/12)

Original Issue


I get the following error in MicrosoftAjaxTemplates.debug.js

Microsoft JScript runtime error: 

,没有其他信息.

function Sys$UI$Template$compile()行中:

and no other information.

in function Sys$UI$Template$compile() on the line:

element._msajaxtemplate = [this._instantiateIn = new Function("__containerElement", "$dataItem", "$index", "__referenceNode", "$parentContext", "__instanceId", code), nestedTemplates];



这是内部html包含的元素(已删除大多数选项;但是,有1,430个选项):



Here is what the element inner html contains (removed most options; however, there are 1,430 options):

<tr><td>Barcode</td><td><input style="width: 100px;" id="txt_Barcode_dcaccc6c-bbd9-4887-b86d-50615fc119d4" onchange="UpdateObserver('Barcode', this.value);" title="Barcode" name="Barcode" maxLength="15" size="100px" type="text" sys:value="{{formatText(Barcode,'')}}" firstfield="true" fieldbinding="Barcode" inputmask=""></td></tr><tr><td>First Name</td><td><input style="width: 200px;" id="txt_EntryFirstName_5eaeb03b-10b1-4477-a0f4-f8981afa1efe" onchange="UpdateObserver('EntryFirstName', this.value);" title="First Name" name="EntryFirstName" maxLength="25" size="200px" type="text" sys:value="{{formatText(EntryFirstName,'')}}" fieldbinding="EntryFirstName" inputmask=""></td></tr><tr><td>Middle Name</td><td><input style="width: 200px;" id="txt_EntryMiddleName_18c90a69-9d7d-4620-8516-b1f820232191" onchange="UpdateObserver('EntryMiddleName', this.value);" title="Middle Name" name="EntryMiddleName" maxLength="25" size="200px" type="text" sys:value="{{formatText(EntryMiddleName,'')}}" fieldbinding="EntryMiddleName" inputmask=""></td></tr><tr><td>Last Name</td><td><input style="width: 200px;" id="txt_EntryLastName_56251525-20ff-4068-adf4-91ba9177dc0c" onchange="UpdateObserver('EntryLastName', this.value);" title="Last Name" name="EntryLastName" maxLength="25" size="200px" type="text" sys:value="{{formatText(EntryLastName,'')}}" fieldbinding="EntryLastName" inputmask=""></td></tr><tr><td>Entry Date</td><td><input style="width: 100px;" id="txt_EntryDate_bf74bc1a-9980-408d-a722-9b51a91fb45b" onchange="UpdateObserver('EntryDate', this.value);" class="date" title="Entry Date" name="EntryDate" maxLength="10" size="100px" type="text" sys:value="{{formatDate(EntryDate,'MM/dd/yyyy')}}" fieldbinding="EntryDate" inputmask="" datefield="true"></td></tr><tr><td>Company</td><td><select style="width: 500px;" id="ddl_1_CompanyID_53f3ff5f-3070-4473-b8d9-e4055e29e0e9"  önchange="UpdateObserver('CompanyID', this.value);" class="queryfield" title="Company" fieldbinding="CompanyID" LoadOnDemand="false" sys:value="{{CompanyID}}" width="500px" showcode="False" descfield="CompanyDescription" codefield="CompanyID" queryid="1" lookupid="1" sys:attach="dataview"><option value="0">(None)</option><option value="6">2ROAM, INC.</option><option value="5">3DSP CORPORATION</option><option value="1437">3M (Sirva)</option><option value="1218">57 STARS LLC</option><option value="1328">69 SLAM</option><option value="901">7 SOFTWARE</option><option value="838">ABGENT INC.</option><option value="7">ACADIA PHARMACEUTICALS, INC.</option><option value="1148">ACCELRYS SOFTWARE INC</option><option value="1123">ACCELRYS SOFTWARE, INC.</option><option value="520">ACCELRYS, INC.</option><option value="517">ACCOUNTMATE SOFTWARE CORPORATION</option><option value="549">ACELO SEMICONDUCTORS, INC.</option><option value="8">ACON LABORATORIES, INC.</option><option value="597">ACOUSTIC TECHNOLOGIES, INC.</option><option value="1390">ACTEL CORPORATION</option><option value="726">ACTIONABLE INTELLIGENCE TECHNOLOGIES, INC.</option><option value="9">ACTIVX BIOSCIENCES, INC.</option><option value="467">ADAC LABORATORIES</option><option value="897">ADC WIRELESS</option><option value="10">ADCOM INFORMATION SERVICES, INC.</option><option value="1290">ADEPT MANAGEMENT</option><option value="924">Advanced Cardiovascular Systems</option><option value="679">ADVANCED MICRO DEVICES, INC.</option><option value="2">ZUCOTTO WIRELESS, INC.</option></select></td></tr>



如果我将整个HTML粘贴到
jsfiddle.net [ ^ ]将显示选择列表(组合框),其中列出了所有选项(无错误).

我以为用于构建选择列表的数据是罪魁祸首,所以我采用了二进制排序方法,其中删除了一半的数据,错误消失了.我测试了另一半,没有错误;但是,所有1,430个选项都会得到错误提示.

尝试的解决方法
下一种方法是将数据加载到选择列表(组合框)的焦点上.在主页上,没问题...控件将重点放在列表中.在PrettyPhoto页面上没有错误;但是,该列表为空.使用 Fiddler2 [ ^ ]我看到JSON数据被传回,并且可以在发生绑定的地方放置一个断点.但是,选择列表(组合框)为空.

我在使用PrettyPhoto时遇到了其他问题,并阅读了以下内容来帮助我解决了日期选择器问题:



If I paste the entire HTML into jsfiddle.net[^] the select list (combo box) renders with all options listed (no error).

I thought that the data used to build the select list was the culprit so I employed a binary sort approach where I deleted half the data and the error went away. I tested the other half and no error; but, will all 1,430 options I get the error.

Attempted Workaround
The next approach was to load the data onfocus of the select list (combo box). On the main page, no problem... control has focus the list populates. On the PrettyPhoto pages no error; however, the list is empty. Using Fiddler2[^] I see the JSON data being passed back and I can put a break point where the binding happens; however, the select list (combo box) is empty.

I''ve run into other issues with PrettyPhoto and read the following that helped me solve my date picker issue:

语录:

''prettyPhoto''每次触发都会创建一个新的DOM,因此日期选择器所绑定的焦点"事件在您的灯箱中的DOM元素上不存在

''prettyPhoto'' create a new DOM everytime it is triggered, so the ''focus'' event that datepicker is bounded to, does not exist on the DOM element in your lightbox

[来源]

我感觉到同一问题与选择列表未加载有关.只是不确定如何解决此问题.

我已经在这个问题上花了很长时间了,引导我朝正确方向前进的任何建议或技巧都将不胜感激.


2012年4月2日更新
该问题似乎并未在Chrome中显示;但是,在FireFox和IE 9中存在此问题.

2012年4月4日更新
删除了漂亮照片的使用,问题仍然存在(此问题似乎是绑定和数据量).
在IE 9(或8)中,我得到了原始问题.
在FireFox和Chrome中...一切都很好.


[Source]

I sense this same issue has to do with the select list not loading. Just not sure how to fix this.

I''ve been banging my head on this issue for some time now, any suggestion or tip to lead me in the right direction will be much appreciated.


Update 4/2/2012
The issue does not seem to present itself in Chrome; however, in FireFox and IE 9 the issue exists.

Update 4/4/2012
Removed the usage of pretty photo and the issue persisted (this issue seems to be the binding and the amount of data).
In IE 9 (or 8) I get the original issue.
In FireFox and Chrome... all is well.


Thanks!

推荐答案

UI


模板


compile()上线:

compile() on the line:

element._msajaxtemplate = [this._instantiateIn = new Function("__containerElement", "


这篇关于Ajax绑定选择(组合框)错误(或列表为空,具体取决于浏览器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆