Hello Guys

I am trying to built a small application where i have a grid view on update panel, along with a dropdown list which shows the list of all columns of my table, and a text box to filter values.

When a user selects a value in dropdownlist (ex: Firstname).
and enters john in textbox i want to update the grid view , where the first names are john.

i am able to show the data in grid view and also able to see my columns name in ddl, but after that i am sure what to do.

Can some body please help me..

Thanks

Use the Filter on your binding source.

Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click

        Try
            DataGridViewForm.YourBindingSource.Filter = String.Format("{0} = '{1}'", _
DataGridViewForm.YourDataSet.YourTable.Columns(columnIndex).ColumnName.ToString, TextBox1.Text)
        Catch
            MessageBox.Show("Database error")
        End Try
        Me.Close()
    End Sub

Check out My Code Project.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.