Gali
Gali

Reputation: 14953

how to UnSelect all rows in GridView - asp.net?

how to UnSelect all rows in GridView - asp.net ?

if i select one row in GridView and make any refresh, how to unselect this row ?

thanks

Upvotes: 4

Views: 10143

Answers (2)

Scott Mitchell
Scott Mitchell

Reputation: 8759

As SvDevMan81 noted, you'd set the GridView's SelectedIndex property to -1.

Similarly, if you have an editable grid and you want to revert the grid to its read-only mode you can set the GridView's EditIndex property to -1.

Upvotes: 0

SwDevMan81
SwDevMan81

Reputation: 49978

Looks like you can set the SelectedIndex to -1.

gridView1.SelectedIndex = -1;

Note: You will need to do this after each databind of new data to the GridView.

Upvotes: 11

Related Questions