473,387 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

how to bind gridview to textbox to search

shivananda
hi, hope every one doing well

i want to link gridview to textbox that can use for search purpose ,if i double click in grid that can be shown in the category form
i attached some screen shoots for ref

thanks in advance

here is my catogery search code pls help me out

Expand|Select|Wrap|Line Numbers
  1. Imports System.Data.SqlClient
  2. Public Class catogorysearch
  3.     Dim con As New SqlConnection
  4.     Private Sub catogorysearch_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  5.  
  6.         con.ConnectionString = "Data Source=SHIVA\SQLEXPRESS2005;Initial Catalog=project_case;Persist Security Info=True;User ID=sa;password=pavanvsmginfo"
  7.         con.Open()
  8.         con.Close()
  9.         showitems()
  10.     End Sub
  11.     Private Sub showitems()
  12.         Dim dt As New DataTable
  13.         Dim ds As New DataSet
  14.         ds.Tables.Add(dt)
  15.         Dim da As New SqlDataAdapter
  16.         da = New SqlDataAdapter("SELECT * FROM category", con)
  17.         da.Fill(dt)
  18.         DataGridView1.DataSource = dt.DefaultView
  19.     End Sub
  20.  
  21.     Private Sub BindingNavigator1_RefreshItems(ByVal sender As System.Object, ByVal e As System.EventArgs)
  22.  
  23.     End Sub
  24.  
  25.  
  26.     Private Sub txtcat_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtcat.TextChanged
  27.  
  28.     End Sub
  29.     Private Sub txtids_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtids.TextChanged
  30.  
  31.     End Sub
  32.  
  33.  
  34. End Class



Attached Images
File Type: jpg pic1.jpg (146.3 KB, 762 views)
File Type: jpg pic2.jpg (132.0 KB, 800 views)
File Type: jpg Pic3.jpg (75.0 KB, 821 views)
Jun 28 '13 #1
1 2044
Frinavale
9,735 Expert Mod 8TB
Well, it looks like you are handling the TextBoxes' TextChanged events but you aren't doing anything within the methods.

In those methods, you should either set DataGridView1.DataSource to a filtered version of the DataTable using the DataTable.Select method or you could re-query the the database using a where clause with the provided text (please use Parameterized Queries).

-Frinny
Jul 2 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: david | last post by:
I have bind a dataset, DentistDataSet1, to TextBox, txtLastName, by set the textbox property (databindings--> simple binding--> ... -->LastName) and also bind it to a dropdown list, DropdownList1...
5
by: Steven Baggs | last post by:
Hi!, I have defined a List<T> like this List<Container> Container class holds my Item object and it's state as a Enum. Container.Item Container.State I would like to bind it to GridView.
2
by: johnlim20088 | last post by:
Hi Someone please help me string typ; if (e.Row.RowType == DataControlRowType.DataRow) { typ = e.Row.Cells.Text;
0
by: jaz215 | last post by:
Hi i have an update page where i update data when a user select a row in the gridview, i also have a search function that displays the data in the gridview all those data that matched the search. my...
1
by: svchosthunter | last post by:
I want to bind a gridview with data table but I need one field as combo box as DataGridviewComboBoxColumn I want that when I bind my grid there should be a combo box in grid which will be binded to...
2
by: wildman | last post by:
RE: Gridview textbox has data check without postback.. javascript? I have a gridview with a textbox. I can set the textbox to autopostback and check for a value in a prerender event to decide if...
3
by: dorandoran | last post by:
I followed this blog and I was able to utilized the search option for gridview. http://www.c-sharpcorner.com/Blogs/BlogDetail.aspx?BlogId=825 Now I created another button "btnClearSearch" and I...
2
by: rajsrmc | last post by:
Hello experts Let's say I have a gridview with some columns like, title, name, funding agency. Here's an example of what I want to do: I want to display all the records in the gridview to start....
1
by: ajith3000 | last post by:
hi everyone,please help me .i'm a newbie see i have a form in that i have following controls .combobox .textbox .listview the combobox contains all the column names of listview like...
3
by: Nivia | last post by:
Am trying to bind a value that comes from DB to a asp:textbox in gridview. but am unable to use bind & parsefloat together. where do i include parsefloat in the below code line Text='<%#...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.