如何过滤pin码&带有自动完成文本框的区域 [英] how to filter pin code & area with Auto complete Text box

查看:94
本文介绍了如何过滤pin码&带有自动完成文本框的区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何过滤pin码&带有自动填充文本框的区域带有唯一ID的其他文本框,自动完成文本框有pin码&在asp.net的区域





table #################### ###

how to filter pin code & area with Autocomplete Text box to others text box with unique id , auto complete text box have pin code & Area in asp.net


table#######################

CREATE TABLE [dbo].[tbl_report_particular](
	[Pin_code] [int] IDENTITY(1,1) NOT NULL,
	[area_name] [nvarchar](max) NULL,
	
GO



所选文字更改****** *********************************代码


selected text change ***************************************code

protected void txt_testname_TextChanged(object sender, EventArgs e)
   {
       try
       {
           SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["sql_date"].ConnectionString);
           con.Open();
           string query = "select_id";
           SqlCommand cmd = new SqlCommand(query, con);
           cmd.CommandType = CommandType.StoredProcedure;
           DataTable dt = new DataTable();
           SqlDataAdapter da = new SqlDataAdapter(cmd);
           da.Fill(dt);
           txt_testname.Text = dt.Rows[0]["Name_test"].ToString();
           txt_unit.Text = dt.Rows[0]["Id"].ToString();
           con.Close();

       }

       catch (Exception ex)
       {
           Response.Write(ex.Message);
       }
   }



商店程序代码****************** ********************************


store procedure code**************************************************

USE [test_dignostic]
GO
/****** Object:  StoredProcedure [dbo].[select_id]    Script Date: 09/03/2015 17:30:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[select_id]


AS
BEGIN

    -- Insert statements for procedure here
	SELECT Id, Name_test from tbl_report_particular
END

推荐答案

在实现自动填充文本框时,文本框textchanged事件无济于事。你需要采取正确的方法。有两种方法可以在文本框中实现自动完成功能

1.通过JQuery自动完成

2.通过AjaxControlToolkit AutoCompleteExtender



现在,我不需要在这里分享任何代码,因为互联网上有很多文章可用。只要给他们中的一个尝试,让我们知道你是否卡在任何地方。



检查以下链接 -

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

JQuery:ASP.Net C中的自动完整文本框#

[ ^ ]



希望,有帮助:)
While implementing autocomplete text box, text box textchanged event will not help much. You need to take the right approach. There are two options to implement autocomplete feature to your text box
1. Through JQuery autocomplete
2. Through AjaxControlToolkit AutoCompleteExtender

Now, I don't need to share any code here as there are a good no of articles available over Internet. Just give one of them a try and let us know if you stuck anywhere.

Check following links-
AutoComplete With DataBase and AjaxControlToolkit[^]
JQuery: Auto Complete Text Box in ASP.Net C#
[^]

Hope, it helps :)


这篇关于如何过滤pin码&带有自动完成文本框的区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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