Erik Dekker
Erik Dekker

Reputation: 2433

How to persist the SelectedValue in a GridView when the rows are updated

I have a parent GridView that is bound to an EntityDataSource with a child DetailView. The child DetailView is bound to the parent by an EntityDataSource, with a ControlParameter as WhereParameter that points to the parent GridView.

When a user selects a row in the GridView, the DetailView is updated with the correct values.

The views are in an UpdatePanel and by entering a value in a TextBox, the user can search through records from the parent GridView. When a user selects a record in the parent view (say row index 1), the child is updated. But if the user starts a search now, the row on index 1 gets a different SelectedValue, so the DetailView is updated.

I want to persist the SelectedValue when a user selects a record. Can I prevent the GridView SelectedValue from changing, when a user starts a search?

Upvotes: 1

Views: 356

Answers (1)

unarity
unarity

Reputation: 2445

I didn't understood ver well, is this helping you?

EnablePersistedSelection="true"

Enable this on GridView

Upvotes: 3

Related Questions