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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Getting Multi Selected Row problem

Thread ID:

Created:

Updated:

Platform:

Replies:

48190 Aug 22,2006 09:19 AM UTC Aug 24,2006 03:19 AM UTC WinForms 5
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On August 22, 2006 09:19 AM UTC

Hi,

I''m having problems getting the selected row index for 2 different cases.

First the Continous Multiselections of rows, which i use the following codes to get the first column''s cell value, please refer to "ContinousSelections.JPG" for a better understanding of my situation:

int rowCount = dgDocument.Selections.Ranges.ActiveRange.Height;
if (rowCount > 0)
{
ArrayList arDeleteDocumentNo = new ArrayList();
foreach (GridRangeInfo r in this.dgDocument.Selections.Ranges)
{
for (int row = r.Top; row <= r.Bottom; row++)
{
string delDocumentNo = this.dgDocument[row, 1].CellValue.ToString().Trim();
arDeleteDocumentNo.Add(delDocumentNo);
}
}

Then the NonContinous Multiselections of rows, which i use the following codes to get the first column''s cell value, please refer to "NoNContinousSelections.JPG" for a better understanding of my situation:

int rowCount = dgDocument.Selections.GetSelectedRows(true, true).Count;
if (rowCount > 0)
{
ArrayList arDeleteDocumentNo = new ArrayList();
foreach (GridRangeInfo r in this.dgDocument.Selections.GetSelectedRows(true, true))
{
for (int row = r.Top; row <= r.Bottom; row++)
{
string delDocumentNo = this.dgDocument[row, 1].CellValue.ToString().Trim();
arDeleteDocumentNo.Add(delDocumentNo);
}
}

Is there any way i could get the cellvalues i want combining the 2 types of multiselections approach i''ve attached with this post?

Please message me if my question is not clear enough or if you have any doubts about my post.
Thanks in advance. :)

MultiSelectionsProblem.zip

Administrator [Syncfusion]
Replied On August 22, 2006 09:25 AM UTC

I''m sorry that i missed out a very important information. I''m using GridDataBound. :)

Administrator [Syncfusion]
Replied On August 22, 2006 11:00 AM UTC

Hi Wye,

You can call the GetSelectedRows() method to get the Selected rows in a grid. Please refer the attached sample for more details.

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/Selection_b6f085dc.zip

Let me know if this helps.
Regards,
Haneef

Administrator [Syncfusion]
Replied On August 23, 2006 03:47 AM UTC

Hi Haneef,
thanks for replying :)
I''m using GetSelectedRows(true, true) now, and i''m using SelectionMode.MultiExtended now. if i hold shift and Arbitrary Select few records. I''ll only get one result(I should have get multiple selected records).

I tried using MultiSimple selectionMode, it works, but it doesn''t suite my User Interface flow.

I''ve attached the sample project to my situtations, i hope this help you to understand my problems.

Thanks in advance :)

WindowsApplication215.zip

Administrator [Syncfusion]
Replied On August 23, 2006 06:06 AM UTC

Hi Wye,

The reason is that GetSelectedRows method returns the GridRangeInfoList object. You are using the Count property of GridRangeInfoList to get the no of the selected range in a grid [Not a selected rows]. If you want to get the no. of selected rows in a grid , try this code

//==========Get Delete Marker No==================
int RowCount = 0 ;
ArrayList arDeleteKey = new ArrayList();
foreach (GridRangeInfo r in this.dg.Selections.GetSelectedRows(true, true))
{
for (int row = r.Top; row <= r.Bottom; row++)
{
string deletekey = this.dg[row, 1].CellValue.ToString().Trim();
arDeleteKey.Add(deletekey);
RowCount++;
}
}
//==============================================

Console.WriteLine("Number of Selected rows in a Grid : " + rowCount);

Let me know if this helps.
Best Regards,
Haneef

Administrator [Syncfusion]
Replied On August 24, 2006 03:19 AM UTC

Thanks a lot Haneef.. It works.. :)

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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon 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.Close Icon

;