自动建议使用AJAX控件工具箱,将值传递给数组
本文关键字:值传 数组 工具箱 控件 AJAX | 更新日期: 2023-09-27 18:05:56
这是为自动建议使用AJAX控件工具包我正在创建一个会话,并通过页面加载
将值传递给这个页面。 protected void Page_Load(object sender, EventArgs e)
{
if
(Session["useremail"] == null) Response.Redirect("Home.aspx");
else
Label8.Text = Session["useremail"].ToString();
}
我想使用标签8。在下面的方法中的文本值,以便我可以使用它来查询数据库并从数据库到数组movies给出结果(Firstname来自用户表)。
[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
public static string[] GetCompletionList(string prefixText, int count, string contextKey)
{
string[] movies = { "Joey", "Joester", "Joker", "Joeic", "Joic", "Shrek II" };
return (from m in movies where m.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase) select m).Take(count).ToArray();
}
请告诉我如何将firstname值从表用户传递到数组
您需要使用UpdatePanel进行AJAX调用,该UpdatePanel以您的WebService作为其端点。您可以设置如下所示的AsyncTrigger,它传递给后面的代码,该代码读取标签文本的值并调用web服务。如果您使用MVC,则方法略有不同。