问题描述
vs2008:目的是想用第三个参数传一个值,以便准确列出此客户的成品,代码如下<asp:TextBoxID="custno"runat="server"Width="100px"></asp:TextBox><asp:GridViewID="GridView1"runat="server"AutoGenerateColumns="False"DataKeyNames="id"CssClass="GVTab"onrowdatabound="GridView1_RowDataBound"onrowdeleting="GridView1_RowDeleting"><Columns><asp:BoundFieldDataField="id"HeaderText="id"/><asp:CommandFieldShowDeleteButton="True"ItemStyle-Font-Size="11px"DeleteText="删"/><asp:TemplateFieldHeaderText="项次"><ItemTemplate><asp:TextBoxID="project_no"runat="server"Text='<%#Eval("project_no")%>'Width="50px"/></asp:TextBox></ItemTemplate></asp:TemplateField><asp:TemplateFieldHeaderText="成品编号"><ItemTemplate><asp:TextBoxID="bom"runat="server"AutoCompleteType="Disabled"Ontextchanged="bom_TextChanged"AutoPostBack="false"Text='<%#Eval("bom")%>'Width="150px"/></asp:TextBox><cc1:AutoCompleteExtenderID="AutoCompleteExtender1"runat="server"TargetControlID="bom"EnableCaching="false"MinimumPrefixLength="1"CompletionInterval="300"CompletionSetCount="20"UseContextKey="true"ServicePath="WebService.asmx"ServiceMethod="getBom_for_so"></cc1:AutoCompleteExtender><scripttype="text/javascript">//此过程不能放在JS文件里面,否则没有效果functionOnTxtPersonInfoKeyDown(){varcustno=document.getElementById("<%=custno.ClientID%>");varAutoCompleteExtender1ClientId="<%=AutoCompleteExtender1.ClientID%>";//错误提示:当前上下文中不存在名称“AutoCompleteExtender1”varAutoCompleteExtender1=$find(AutoCompleteExtender1ClientId);if(AutoCompleteExtender1!=null)AutoCompleteExtender1.set_contextKey(custno.value);}</script></ItemTemplate></asp:TemplateField></Columns><AlternatingRowStyleCssClass="alt"/><HeaderStyleBackColor="Silver"/></asp:GridView>运行后出现错误提示:当前上下文中不存在名称“AutoCompleteExtender1”
解决方案
本帖最后由 glassy2000 于 2014-12-01 11:42:29 编辑