Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted

Have a look here[^]. Change the where clause in the query and bind the data again (whenever the roll no is changed).
 
Share this answer
 
Comments
Uday P.Singh 26-Sep-11 1:38am    
Agree my 5!
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
 
Share this answer
 
v2
C#
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();
 
Share this answer
 
v4
Comments
raj ch 26-Sep-11 1:59am    
my vote of 5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900