Focus on selected GridVIew row asp.net

Hi,

Have a GridView in asp panel and without scrolling I can see 11 rows, but when I scroll and select some other row on postback I have to scroll again. How can I leave focus on selected row?vb is code-behind.

Thanks.
LVL 1
kahvedzicAsked:
Who is Participating?
 
Reza RadConsultant, TrainerCommented:
you can use this:
gridview1.SelectedRow.Focus()
0
 
Meir RivkinFull stack Software EngineerCommented:
u can save selected row index and after postback scroll back to this row index using FirstDisplayedScrollingRowIndex property
0
 
kahvedzicAuthor Commented:
add
gridview1.SelectedRow.Focus()

to page load and still have to scroll.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Reza RadConsultant, TrainerCommented:
put it on your gridview ,rowCommand event
0
 
kahvedzicAuthor Commented:
now that is what I want. Thanks

Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged

GridView1.SelectedRow.Focus()

End Sub
0
 
Reza RadConsultant, TrainerCommented:
so, if your event was selectedindexchanged then you must put it in this event.
Glad to help,
Regards,

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.