I have a gridview that populates from a sqlDataSource
I added a textBox and a button to input company name in a textBox and click the button to search. Once the row with company is found I want to update it, but when I click update in this row, the gridview displays all of the rows, and instead of the one from the search results, the first row at the top is displayed in update template.
The GridView first is populated from a static sqlDataSource (EditDistributor), that displays all of the columns in a table.
SelectCommand="SELECT [company], [d_address], [country], [phone], , [ddate], [distr_id] FROM [distributors]"
UpdateCommand="UPDATE [distributors] SET [company] = @company, [d_address] = @d_address, [country] = @country, [phone] = @phone, = @email, [ddate] = @ddate WHERE [distr_id] = @distr_id">
Then in this click event I call a StoredProcedure:
Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSearch.Click
EditDistributor.SelectCommandType = SqlDataSourceCommandType.StoredProcedure
View Complete Post