4

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

2 Answers 2

11

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.

Sign up to request clarification or add additional context in comments.

1 Comment

In your answer you cite SelectedIndex, but then in your code sample you use SelectedRow. I think you mean to use SelectedIndex throughout.
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.