473,563 Members | 2,703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataGrid Row Selection

Hey folks,

Is there a way to make the data grid always select a row only and not an
individual cell?

Like...When I click on the row header it highlights the whole row in blue.
But when I then click on a cell in another row, it selects just that cell.
I don't want that. I want it to behave the same way as when clicking on the
row header.

Thanks!
Nov 16 '05 #1
4 16687
Sure, just use Select() to select the row, e.g.

myDataGrid.Sele ct(CurrentCell. RowNumber);

Just do this every time a new cell is selected.

--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
"John Smith" <js@no.com> wrote in message
news:%2******** *******@TK2MSFT NGP10.phx.gbl.. .
Hey folks,

Is there a way to make the data grid always select a row only and not an
individual cell?

Like...When I click on the row header it highlights the whole row in blue.
But when I then click on a cell in another row, it selects just that cell.
I don't want that. I want it to behave the same way as when clicking on the row header.

Thanks!

Nov 16 '05 #2
But then how can I capture the double click of a row? Cells don't seem to
have a double click event.
"Kai Brinkmann [MSFT]" <ka******@onlin e.microsoft.com > wrote in message
news:uS******** ******@TK2MSFTN GP12.phx.gbl...
Sure, just use Select() to select the row, e.g.

myDataGrid.Sele ct(CurrentCell. RowNumber);

Just do this every time a new cell is selected.

--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.

"John Smith" <js@no.com> wrote in message
news:%2******** *******@TK2MSFT NGP10.phx.gbl.. .
Hey folks,

Is there a way to make the data grid always select a row only and not an
individual cell?

Like...When I click on the row header it highlights the whole row in blue. But when I then click on a cell in another row, it selects just that cell. I don't want that. I want it to behave the same way as when clicking on

the
row header.

Thanks!


Nov 16 '05 #3
No, but the DataGrid control has both Click and DoubleClick events. All you
need to do is identify the selected row or cell in the event handlers for
these events and write the appropriate code. The CurrentCellChan ged event
might also be helpful.

--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
"John Smith" <js@no.com> wrote in message
news:OD******** ******@TK2MSFTN GP09.phx.gbl...
But then how can I capture the double click of a row? Cells don't seem to
have a double click event.
"Kai Brinkmann [MSFT]" <ka******@onlin e.microsoft.com > wrote in message
news:uS******** ******@TK2MSFTN GP12.phx.gbl...
Sure, just use Select() to select the row, e.g.

myDataGrid.Sele ct(CurrentCell. RowNumber);

Just do this every time a new cell is selected.

--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no

rights.


"John Smith" <js@no.com> wrote in message
news:%2******** *******@TK2MSFT NGP10.phx.gbl.. .
Hey folks,

Is there a way to make the data grid always select a row only and not an individual cell?

Like...When I click on the row header it highlights the whole row in blue. But when I then click on a cell in another row, it selects just that cell. I don't want that. I want it to behave the same way as when clicking
on the
row header.

Thanks!



Nov 16 '05 #4
But I mean, I was expecting to have the ability to double click anywhere on
a row and have it fire the double click event. But now it seems the only
way you can doubleclick is to click on the row header?

The CurrentCellChan ged event is single click (in which case the row is just
selected).
"Kai Brinkmann [MSFT]" <ka******@onlin e.microsoft.com > wrote in message
news:#5******** ******@TK2MSFTN GP11.phx.gbl...
No, but the DataGrid control has both Click and DoubleClick events. All you need to do is identify the selected row or cell in the event handlers for
these events and write the appropriate code. The CurrentCellChan ged event
might also be helpful.

--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.

"John Smith" <js@no.com> wrote in message
news:OD******** ******@TK2MSFTN GP09.phx.gbl...
But then how can I capture the double click of a row? Cells don't seem to
have a double click event.
"Kai Brinkmann [MSFT]" <ka******@onlin e.microsoft.com > wrote in message
news:uS******** ******@TK2MSFTN GP12.phx.gbl...
Sure, just use Select() to select the row, e.g.

myDataGrid.Sele ct(CurrentCell. RowNumber);

Just do this every time a new cell is selected.

--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"John Smith" <js@no.com> wrote in message
news:%2******** *******@TK2MSFT NGP10.phx.gbl.. .
> Hey folks,
>
> Is there a way to make the data grid always select a row only and

not an > individual cell?
>
> Like...When I click on the row header it highlights the whole row in blue.
> But when I then click on a cell in another row, it selects just that

cell.
> I don't want that. I want it to behave the same way as when
clicking on the
> row header.
>
> Thanks!
>
>



Nov 16 '05 #5

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

Similar topics

8
7896
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the header of the datagrid in the "ItemDataBound" method of the grid. However, once, they are added in the grid, i seem to lose the event handler for the...
2
9911
by: Chris Plowman | last post by:
Hi all, I was wondering if anyone can help me with a really annoying problem I have been having. I made a derived datagrid class that will select the row when a user clicks anywhere on a cell (multi-select without modifier keys). I got that working fine, but I also wanted to keep rows selected after a sort, which I do by storing the row's...
6
1704
by: BBFrost | last post by:
I'm using Net 1.1 (2003) SP1 & Windows 2000 Here's the issue ... Rows 12 thru 24 are selected in a datagrid. The user now unselects rows 12 thru 24 and selects rows 45 thru 70 ??? How can I tell that the user has reselected a different set of rows in a datagrid.
0
1423
by: MrNobody | last post by:
hey guys... I'm trying to make my DataGrid have selection behavior similar to WindowsExplorer, where I can hold CTRL to add rows to a multi-row selection. Thanks to someone else on this newsgroup, I found out how to detect if CTRL is pressed while in my MouseUp event, which is when it's supposed add that row to the selection. (Otherwise, if...
1
3378
by: MrNobody | last post by:
Is it at all possible to override the default behavior of a DataGrid when the mouse is clicked on a row? I am having a problem where I am trying to select multiple rows in a DataGrid by left-clicking them, but each time I click another row to add it to the selection the previously added row loses it's highlighting, so it appears as though only...
6
3309
by: Alpha | last post by:
I have several textboxes that I need to chang the text when the selection row is changed in a datagrid. I have the following code. This textbox displayes the initial selection but when I click on different rows in the datagrid, the textbox content doesn't change to reflect the change. How can I address this? Also, If the user change the...
3
2358
by: Zachary Hilbun | last post by:
I'm using a DataGrid control in a web form. I can display it using binding but when I click on any of the items there is no feedback that that row has been selected. I changed SelectedItemStyle but the changes do not appear when a row is clicked. What do I need to do to get it to do selection? ...
1
2113
by: thegame | last post by:
Filling One DataGrid Based on Selection from Another DataGrid - Both in Separate User Controls Hello, I have an interesting dilemma. I have an ASPX page with two user controls (two ASCXs). Both ASCXs have DataGrids on them. The first user control's DataGrid is populated from our database on page load. The DataGrid also has a Select...
5
344
by: I am Sam | last post by:
I have a rather complicated problem I need to sort out and wonder if anyone can assist me. The ingredients: Two DropDownList Controls One DataGrid Purpose of Page:
13
2458
by: pmcguire | last post by:
I have a DataGrid control for which I have also created several new extended DataGridColumnStyles. They behave pretty nicely, but I can't figure out how to implement Selected Item formatting for them. In a plain vanilla DataGrid, when you click on the RowHeader, the appropriate row changes colors. I ASSUME this should be done in the Paint...
0
7580
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7882
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8103
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7634
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7945
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6244
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3634
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3618
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1194
muto222
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.