如何使用文本框获取数据以获取某些值 [英] How do I get the data with textbox on wirttinening some value

查看:107
本文介绍了如何使用文本框获取数据以获取某些值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要的代码是当我在文本框中输入名称而不点击按钮时,应该显示与该名称相关的数据。请帮助我



< b>我尝试了什么:



i want the code that when i entered name in a textbox without clicking on button the data should be displayed related to that name.please help me out

What I have tried:

protected void txtSearchName_TextChanged(object sender, EventArgs e)
    {
        try
        {
            ub.Mode1 = "SearchbyName";
            ub.Name1 = txtSearchName.Text;
            DataSet ds = ub.GetUsers();
            if (ds.Tables[0].Rows.Count > 0)
            {
                list.Visible = true;
                lvsearch.Visible = true;
                dllusers.DataSource = ds;
                dllusers.DataBind();

            }
            else
            {
                list.Visible = false;

            }

        }
        catch (SqlException ex)
        {
            lblMessage.Text = "";
            lblMessage.Text = ex.Message;
        }
    }

推荐答案

您好,

要实施自动填充搜索,请尝试以下链接

1。 使用AJAX从数据库实现jQuery AutoComplete TextBox ASP.Net中的PageMethods

2. Asp.net中的jQuery自动完成文本框,数据库示例使用C#,VB.NET



谢谢
Hello ,
To Implement autocomplete search, try below links
1. Implement jQuery AutoComplete TextBox from database using AJAX PageMethods in ASP.Net
2.jQuery Autocomplete Textbox in Asp.net with Database Example using C#, VB.NET

Thanks


TextChanged 事件只有在焦点移出控制。

根据您所指的评论自动完成 TextBox



check这些

使用 Asp AJAX ToolKit

自动完成示例 [ ^ ]

AJAX AutoCompleteExtender示例在ASP.Net中 [ ^ ]

使用DataBase和AjaxControlToolkit自动完成 [ ^ ]



使用JQuery AJAX

自动完成| jQuery UI [ ^ ]
TextChanged event will fire only when the focus is moved out of the control.
based on your comments you are referring to AutoComplete TextBox

check these
using Asp AJAX ToolKit
AutoComplete Sample[^]
AJAX AutoCompleteExtender Example in ASP.Net[^]
AutoComplete With DataBase and AjaxControlToolkit[^]

using JQuery AJAX
Autocomplete | jQuery UI[^]


这篇关于如何使用文本框获取数据以获取某些值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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