How to set focus to a particular row in datagrid ??.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi Friends,
In a window form I have a datagrid and certain action of user
I want to select and set a focus to a particular row. I am to select a
particular row using dataGrid1.Select(int row), but I am not able to set
focus to that particular row.
 
Hi,

If you know the row index of the row you want to be selected something
like this will work:

// untested.
dataGrid1.CurrentRowIndex = X;

where X is the index of the row you want to make selected.

Bye,
Peter
 
Hi Peter,

I am able to select a particular row in datagrid but the problem
is how to set the focus to a Given row.

Cheers,
Abhi
 
Thanks Peter.....dataGrid1.CurrentRowIndex = X; is what I required.
Its working for me.

Cheers,
Abhi
 
Hi, I am confused. I have the same (or similar) problem. I would like to set
the focus to one of the controls in the "selected" datagrid row. However,
there is no such property/attribute as "CurrentRowIndex" supplied by the
datagrid object that I can find. ????
 
If I'm not mistaken, you can try int x = DataGrid.CurrentCell.RowNumber;
Hope this is what you want.... :)
 
I think you are mistaken. Maybe you did not read the orig. part of the
discussion? Even then, the expression you provide is not valid (at least not
with my, .net base, data grid object). So am still none the wiser. I have,
however, managed to get arround the problem by inserting a jscript focus
setting line with a databound control name which I retrieve with the ClientId
property of the datagrid's edit item control after the data grid is bound.
But seems that it should be easier.
 
Back
Top