473,473 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

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.
Nov 16 '05 #1
6 23135
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
"Abhi poddar" <Abhi po****@discussions.microsoft.com> wrote in message
news:D7**********************************@microsof t.com...
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.

Nov 16 '05 #2
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

"Peter Row" wrote:
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
"Abhi poddar" <Abhi po****@discussions.microsoft.com> wrote in message
news:D7**********************************@microsof t.com...
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.


Nov 16 '05 #3
Thanks Peter.....dataGrid1.CurrentRowIndex = X; is what I required.
Its working for me.

Cheers,
Abhi

"Peter Row" wrote:
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
"Abhi poddar" <Abhi po****@discussions.microsoft.com> wrote in message
news:D7**********************************@microsof t.com...
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.


Nov 16 '05 #4
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. ????

"Peter Row" wrote:
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
"Abhi poddar" <Abhi po****@discussions.microsoft.com> wrote in message
news:D7**********************************@microsof t.com...
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.


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

--
Message posted via http://www.dotnetmonster.com
Nov 16 '05 #6
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.

"yaya via DotNetMonster.com" wrote:
If I'm not mistaken, you can try int x = DataGrid.CurrentCell.RowNumber;
Hope this is what you want.... :)

--
Message posted via http://www.dotnetmonster.com

Nov 16 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: raj | last post by:
Hi, The focus in the datagrid is not lost even after leaving the datagrid. The selected cell is highlighted even when the focus from the datagrid is lost. This happens only after the .NET...
0
by: ED M. | last post by:
Hello all...I'm new to the board. I have a problem that I hope someone here might be able to solve for me. I am doing some clientside validation using Javascript. The text I am testing is...
5
by: Bryan Masephol | last post by:
Hi All I got a datagrid and a ComboBox on a form. I populate the combobox with years for all the data avaiable. When the user chooses a year the datagrid is populated with the specific years...
0
by: Shravan | last post by:
Hi, I have a Windows Forms Custom DataGrid, which is put in a usercontrol, which on setting DataSource is setting focus to grid. The call stack for setting the focus is as follows. This is not...
1
by: rroca | last post by:
I hae a WEB application that uses a datagrid. My first 2 rows are Template columns with Dropdown lists. My Third column as databound cell. When I go to edit a particular row I want the focus to...
2
by: LCH | last post by:
I have a form with a datagrid. The datagrid contains 5 columns and 5 rows. the cell of the last column and the last row in the datagrid is set to editable. When the form loads, I want the current...
21
by: Sharon | last post by:
I have added an auto scroll feature to my DataGrid control like this: private void DoAutoScroll() { DataView dv = m_DataGrid.DataSource as DataView; DataGridCell cell = m_DataGrid.CurrentCell;...
3
by: sailu | last post by:
Hi, Anyone knows how can i set the focus to a particular cell in DataGrid. Thanks, Sailaja.
0
by: pankajpr | last post by:
Hi All, I have a datagrid which is populated with 1000 of rows. Now i have designed a functionality which searches for a particular row in this datagrid. Now i need to set focus to only this...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.