GridView Rows Navigation using arrow Keys in ASP.NET


I have to highlight a grid view row using keyboard up & down arrow keys. If the user selects the gridview row using a key it should get highlighted and the user should be able to navigate using the keys.
I have used the code from
It works fine if there is no postback for a grid row selection.
I am using it with my gridview and for each row click it will call a button click functionality.
When it is posting back the highlighting is not staying ..Can anyone suggest any solution to this?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Try to set SelecteRowStyle Property with same styling as you are doing in javascript function.
So when you select a row by clicking the selected row styling will be applied to that row on postback.
Ref :

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Srinivas_VengalaAuthor Commented:
I will check this later
Srinivas_VengalaAuthor Commented:
Didn't get a chance to check this.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.