Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3438
  • Last Modified:

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.
0
kahvedzic
Asked:
kahvedzic
  • 3
  • 2
1 Solution
 
Meir RivkinFull stack Software EngineerCommented:
u can save selected row index and after postback scroll back to this row index using FirstDisplayedScrollingRowIndex property
0
 
Reza RadCommented:
you can use this:
gridview1.SelectedRow.Focus()
0
 
kahvedzicAuthor Commented:
add
gridview1.SelectedRow.Focus()

to page load and still have to scroll.
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
Reza RadCommented:
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 RadCommented:
so, if your event was selectedindexchanged then you must put it in this event.
Glad to help,
Regards,

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now