在asp.net的文本框中写入一列数据时,在gridview中显示详细记录? [英] show detail records in a gridview when one column data is writen in textbox in asp.net?

查看:68
本文介绍了在asp.net的文本框中写入一列数据时,在gridview中显示详细记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

有两个控件,一个是文本框和Gridview,我想在我输入一个列数据时显示Gridview中的所有记录.假设有一个雇员表具有ID,NAME,SAL和ADDRESS列,所以当我在该文本框的总数据将显示在Gridview中.


在Advance中致谢

Hi all,

There are two controls one is a textbox and Gridview,i want to show all records in a Gridview when i type one column data.Suppose there is an employee table having columns ID,NAME,SAL and ADDRESS,so when i type the ID in the textbox its total data will be shown in the Gridview.


Thanks in Advance

推荐答案

选中此
http://www.asp.net/data-access/tutorials/declarative-parameters-cs [^ ]
Check this
http://www.asp.net/data-access/tutorials/declarative-parameters-cs[^]


嗨.试试这个

Hi. Try with this

conn.Open();
SqlDataAdapter da = new SqlDataAdapter("select *  from employee where ID="+textbox1.text+" or NAME like ''"+textbox1.text+"'' or SAL="+textbox1.text+" or ADDRESS=''"+textbox1.text+"''", conn);
DataTable t = new DataTable();
da.Fill(t);
grid.DataSource = t;
grid.DataBind();



将其写在文本框" textchanged事件中



write this in Text box textchanged event


这篇关于在asp.net的文本框中写入一列数据时,在gridview中显示详细记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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