在UpdatePanel和模态弹出窗口中使用Ajax自动完成功能,需要对代码进行修改。以下是解决方法的具体步骤和代码示例:
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; using System.Web.Script.Services;
[WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.Web.Script.Services.ScriptService]
public class AutoComplete : System.Web.Services.WebService
{
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string[] GetCompletionList(string prefixText, int count)
{
List
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ScriptManager1.RegisterAsyncPostBackControl(txtSearch); } }
function pageLoad() { var txtSearch = $get("