 |
| General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category.
** PLEASE BE SPECIFIC WITH YOUR QUESTION **
When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

May 18th, 2004, 01:24 AM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Multiple selection in Datagrid w/o RowHeaders
Hi All,
I'm developing an app where I have a situation wherein I need to allow users to select multiple rows of a DataGrid without using RowHeaders. I need to give users all the facilities of selecting multiple rows of the grid using CTRL button and clicking the rows in the grid but I can't use the RowHeaders (this is the client's requirement). Can somebody help me in this... I know there is a Select method of a grid which allows to select a whole row but how will I be able to know which row of the grid user has selected???
Thanks.
Debsoft
__________________
cheers,
debsoft
|
|

May 18th, 2004, 02:16 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
By default, a DataGrid does not support selecting multiple rows at once. One way to overcome this, is to add a column with checkboxes your user can check. At the server you can loop through the items in the grid and see what checkbox was checked. Take a look here for an implementation of this:
http://www.dotnetjunkies.com/Tutoria...E0F024EC0.dcik
Your Ctrl-Click requirement can also be solved with this. Add some JavaScript that detects the rows that are clicked, and save the values of the clicked rows in hidden fields or JavaScript variables that are submitted back to the server. This way, you don't need the column with Checkboxes.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

May 19th, 2004, 07:13 AM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Imar,
Thanks for your reply... I have found a solution to my problem. Basically I simulated the actions that occur when using RowHeaders.
I trapped an event of DataGrid(CurrentCellChanged) and in this event I checked which row was clicked by the user...then I stored the clicked row in a list(collection of rows clicked) and also selected that row by using the Select method of DataGrid...So I did without using RowHeaders...It's working fine now...Thanks
Regards,
Debsoft
Quote:
quote:Originally posted by Imar
Hi there,
By default, a DataGrid does not support selecting multiple rows at once. One way to overcome this, is to add a column with checkboxes your user can check. At the server you can loop through the items in the grid and see what checkbox was checked. Take a look here for an implementation of this:
http://www.dotnetjunkies.com/Tutoria...E0F024EC0.dcik
Your Ctrl-Click requirement can also be solved with this. Add some JavaScript that detects the rows that are clicked, and save the values of the clicked rows in hidden fields or JavaScript variables that are submitted back to the server. This way, you don't need the column with Checkboxes.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|
|

June 22nd, 2006, 01:26 PM
|
|
Registered User
|
|
Join Date: Jun 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi
I am too goinf through the same problem, could you pls send me the code how you solve this problem.
thanks
Dhanu Gupta
|
|

October 12th, 2006, 11:30 AM
|
|
Registered User
|
|
Join Date: Oct 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I am having the same problem as what you described. Could you send me the code that fixed this for you?
Quote:
quote:Originally posted by debsoft
Hi Imar,
Thanks for your reply... I have found a solution to my problem. Basically I simulated the actions that occur when using RowHeaders.
I trapped an event of DataGrid(CurrentCellChanged) and in this event I checked which row was clicked by the user...then I stored the clicked row in a list(collection of rows clicked) and also selected that row by using the Select method of DataGrid...So I did without using RowHeaders...It's working fine now...Thanks
Regards,
Debsoft
Quote:
quote:Originally posted by Imar
Hi there,
By default, a DataGrid does not support selecting multiple rows at once. One way to overcome this, is to add a column with checkboxes your user can check. At the server you can loop through the items in the grid and see what checkbox was checked. Take a look here for an implementation of this:
http://www.dotnetjunkies.com/Tutoria...E0F024EC0.dcik
Your Ctrl-Click requirement can also be solved with this. Add some JavaScript that detects the rows that are clicked, and save the values of the clicked rows in hidden fields or JavaScript variables that are submitted back to the server. This way, you don't need the column with Checkboxes.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|
|
|
 |