We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Selecting a row in a Datagrid

Thread ID:

Created:

Updated:

Platform:

Replies:

3508 Mar 26,2003 07:23 AM Mar 28,2003 04:01 AM Windows Forms 1
loading
Tags: FAQ
Hurlie
Asked On March 26, 2003 07:23 AM

Hello! I`ve a datagrid on a windows forms. Now i want to test online, which rows are selected. One possibility is to use DataGrid.Isselected(index) in the idle time. But there must be a better way. What i need is an event, like : OnselectingRow(), which is fired everytime, the user selects a new row. tnx for your helps.

Administrator [Syncfusion]
Replied On March 28, 2003 04:01 AM

I thinking looping through and checking IsSelected is teh simplest way for small grids (less than a couple hundred rows or so). If you have thousands of rows, then this woul dnot make sense. You could add an ArrayList and track the selected rows yourself. When a row gets selected add teh index to the ArrayList, when teh row is de-selected, remove it from teh ArrayList. To decide when a row is selected/de-selected, you could handle the MouseDown event and do a HitTest on teh point, checking to a row header hit. This FAQ has code that looks for a column header hit. The row header hit should be similar. Once you know row header was hit, you can look in your ArrayList to see whether you need to remove or add it. How do I get the row or column that has been clicked on? http://www.syncfusion.com/faq/winforms/search/785.asp

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;