Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / October 2005

Tip: Looking for answers? Try searching our database.

MULTISELECT DATAGRID

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
NQ - 28 Sep 2005 14:45 GMT
Is there a good way to get an arraylist of all selected rows in a datagrid
without loop through all the rows of its dataview ???
I have a great number of rows shown on the datagrid. For the performance of
the application I think it's no a good idea to loop through all the rows to
test IsSelected (Row) property.

Many thanks
Signature

NQ

Deep Silent Ocean - 28 Sep 2005 19:52 GMT
Hi..

I think partially you can do this in following way...

in Grid Click event get the HitTestInfo.. this one returns the hti.Row
and hti.Column.

Store this ht.Row in arrayList and get the Primary Key out of this.

Now, from the table do Find on Table with Primary Key so that you can
get the individual row and you don't have to do isSelected from dagarid.

Let me know if you want code snippet then I can provide that also.

Thanks

Silent Ocean...

> Is there a good way to get an arraylist of all selected rows in a datagrid
> without loop through all the rows of its dataview ???
[quoted text clipped - 3 lines]
>
> Many thanks
NQ - 28 Sep 2005 21:03 GMT
This solution doesn't work as I would like.
I would use the CTRL and the CAPS options to select more than one row at the
same time and the mouse dragging it through the rows of the datagrid
selecting and unselecting the rows.
Then I would like to get all the rows selected...

Signature

NQ

> Hi..
>
[quoted text clipped - 21 lines]
> >
> > Many thanks
Deep Silent Ocean - 29 Sep 2005 04:01 GMT
> This solution doesn't work as I would like.
> I would use the CTRL and the CAPS options to select more than one row at the
> same time and the mouse dragging it through the rows of the datagrid
> selecting and unselecting the rows.
> Then I would like to get all the rows selected...

I dont understand what do you mean by dragging, but as I understand when
you press the CTRL button, you can catch which button was pressed in
KeyUp or KeyDow or MouseUp event. Store first hti.Row in temperory
variable and check in those events if CTRL is pressed with left mouse
button click , if yes then select all the rows which are between first
hti.Row and second hti.Row.

by datagrid.select[hti.Row,hti.Column] get the primary key values of the
rows and do DataTable.Find and get the individual rows. And pass that
row collection to some other form...

As I understand you want to do multiple select as we do in Excel by
pressing SHIFT button
NQ - 04 Oct 2005 17:33 GMT
ok
I reached the result
Many thanks...

> > This solution doesn't work as I would like.
> > I would use the CTRL and the CAPS options to select more than one row at the
[quoted text clipped - 15 lines]
> As I understand you want to do multiple select as we do in Excel by
> pressing SHIFT button

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.