如何通过在文本框中输入Roll no来在gridview中显示数据 [英] How to disply data in gridview , by entering Roll no in textbox

查看:69
本文介绍了如何通过在文本框中输入Roll no来在gridview中显示数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表格.有一个roll.no文本框,当我输入一个no.时,我想要那个. ,该rollno如果存在于数据库中的表中,则通过使用带有c#的asp.net 2.0将其相应的值(如name,add等)显示在Gridview中. 希望我的查询清楚.
请尽快答复.谢谢......
让我知道,如果有人知道答案,我对这项技术是陌生的.

I hav a form. there is a roll.no textbox,i want that when i enter a roll no. ,that rollno if exist in a table in the database then it bring its corresponding values like name,add,etc to be displayed in Gridview by using asp.net 2.0 with c# ..
hope my query is clear.
plz reply as soon as possible.thanks......
Ley me know , if anyone know the answer , I am new to this tech.

推荐答案

看看
Have a look here[^]. Change the where clause in the query and bind the data again (whenever the roll no is changed).


获取文本框
和一个按钮,将按钮命名为获取详细信息
并在按钮中单击事件
编写代码以根据文本框中输入的否从数据库中获取记录
现在绑定网格.

我想这对您有帮助

您尝试了上述过程,让我知道您是否遇到任何问题
Take a textbox
and a button,name the button as get details
and in button click event
write the code to fetch the records from database based on the no entered in textbox
Now bind the grid.

I think this will help you

You try the above procedure and let me know if you are facing any problem


SqlDataAdapter da;
SqlConnection objcon= new SqlConnection("your connection string");
str = "SELECT column1,column2 FROM yourtable where rollno='"+yourtextboxid.Text+"'";
da= new SqlDataAdapter(str, objcon);
da.Fill(ds, "tablename");
gridviewid.Datasource=ds.Tables["tablename"];
gridviewid.DataBind();


这篇关于如何通过在文本框中输入Roll no来在gridview中显示数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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