Click here to Skip to main content
15,889,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
A Grid consisting of 100 rows in a page,when user search for a particular record in grid.
How to set gridview focus to the searched record.
Posted
Comments
Sergey Alexandrovich Kryukov 21-Nov-11 3:14am    
What is DataGridView: WPF, Forms, ASP.NET? (Please don't tell me that this control is available here, not there... I know. A control in question should come in fully qualified name, UI library tagged.)
--SA

Hi swathi,
Set Focus of Gridview[^]
 
Share this answer
 
 
Share this answer
 
I think you mix up focus and selection. Focus is a status of a control, nothing else, and it means a keyboard focus, nothing else. Everything else about it is just a visual feedback of a focus. Only one control at a time can have a focus. Whatever you have inside a control may or may not have a selection, not a focus.

In case of DataGridView, selection is done by assigning a value to its property CurrentCell.

—SA
 
Share this answer
 
Comments
swathi.N 21-Nov-11 7:26am    
I want to focus gridview to my selected row. example: I have matching result in 70th row of a grid.If I want to see the result, manully need to scroll the page.So I am loooking to done it by c# or javascripts.
Thank you
GridViewRow row = grVw.SelectedRow;
row.Cells[0].Focus();

By adding these two lines we can scroll the grid.But Focus will work only for editable controls. example like checkbox,hyperlinkfield,linkbutton etc.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900