Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 300
  • Last Modified:

ASP.Net Grideview - Editing wrong row, after a where clause has been applied

I have a standard gridview that is bound to a linq datasource.  Editing/Updating worked fine till I started to filter the datasource.

When the user clicks the search button the datasource correctly filters the grid but when I select 'Update' on one of the rows
- The where clause is no longer used and I see all of the row again
- The wrong row is showing the edit controls in the grid.

Below is the code behind the 'Search' button.

 User_LinqDataSource.Where = "User_FirstName.Contains(@First)"
 User_LinqDataSource.WhereParameters.Clear()
 User_LinqDataSource.WhereParameters.Add("First", TextBox1.Text.Trim)

I am very new to databound controls so I hope this is an easy one for somebody.

Visual Studion 2010
vb.net
0
jongrossex
Asked:
jongrossex
1 Solution
 
jongrossexAuthor Commented:
added an order by to the datasource and it all started to work as expected.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now