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

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.
 
P

Peter 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
 
G

Guest

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
 
G

Guest

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

Cheers,
Abhi
 
G

Guest

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. ????
 
Y

yaya via DotNetMonster.com

If I'm not mistaken, you can try int x = DataGrid.CurrentCell.RowNumber;
Hope this is what you want.... :)
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top