如何将附加信息传递给返回项目集合的服务方法?我将试图解释我的意思,我在表单上有两个文本框,我需要根据数据库中的特定帐户ID填写姓名。所以,我需要传递一个整数给getNamesForDropDown方法。我想不出做什么,所以我做了错误的事情,以及所使用的CompletionSetCount实际上通过我所需要的信息:ASP.NET中的AutoCompleteExtender附加信息
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public string[] getNamesForDropDown(string prefixText, int count)
{
String sql = "Select fldName From idAccountReps Where idAccount = " + count.ToString();
//... rest of the method removed, this should be enough code to understand
//... the evil wrongness I did.
}
在我的前面侧aspx文件,我设置了CompletionSetCount基于关闭用户当前正在该页面上查看的帐户ID。
<ajaxtk:AutoCompleteExtender
runat="server"
ID="AC1"
TargetControlID="txtAccName"
ServiceMethod="getNamesForDropDown"
ServicePath="AccountInfo.asmx"
MinimumPrefixLength="1"
EnableCaching="true"
CompletionSetCount='<%# Eval("idAccount") %>'
/>
所以,这绝对是一个错误的方式......什么是正确的方式?
我该如何控制发送给该方法的前缀文本? – stephenbayer 2008-10-09 19:50:17
哦,我明白了!你是对的。该控件立即关注ServiceMethod,而不会在两者之间停下来。我将需要稍后检查! – azamsharp 2008-10-09 19:54:22