Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MmDataGrid.GetSelectedRows returning too many rows
Message
From
07/10/2005 05:26:45
 
 
To
All
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
MmDataGrid.GetSelectedRows returning too many rows
Environment versions
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01057076
Message ID:
01057076
Views:
62
Hi,

Does mmDataGrid.GetSelectedRows empty its rows when a new single row is selected in a datagrid? I ask because I am getting more than one row in the 'selected rows table' returned from GetSelectedRows after I have selected and deselected a few rows in an mmDataGrid.

To reproduce
--------------------------
1. Select a row in a mmDataGrid.
2. Check the rowcount of mmDataGrid.GetSelectedRows().Tables[0].Rows.Count
3. Select a different row
4. Again, check the rowcount of mmDataGrid.GetSelectedRows().Tables[0].Rows.Count

Thanks in advance,

Andrew

UPDATE : After a little more research I can almost answer my own question :

Looks like mmDataGrid.SelectedRows.Clear is only performed if the mmDataGrid is NOT MultiSelect and you click on the header (see mmDataGrid.cs Method OnMouseDown() LOC 1068 to 1107).

Reproduce (If you have created the Order System CSharp project from the MM Net Development Guide) :
-------------------------------------------------------------------------------------------------------------------------

1. Set a Label on the CustomerOrdersForm
2. In the grdOrders mmDataGrid's onClick event, set the following code :

StringBuilder sb = new StringBuilder();
foreach(object obj in this.grdOrders.SelectedRows)
{
sb.Append(obj.ToString() + " ");
}
this.label1.Text = sb.ToString();

3. Enter "FRANS" in the customerID picker and hit TAB.
4. Randomly select rows in the orders datagrid and see what the label says.

The expected behavior (at least for me) is that the label will contain the index of the currently selected row(s). When I do this test then the index numbers are not reset each time I chose another row. Multiple select also seems to not yeld the correct index numbers for the currently selected rows.

Sincerely,

Andrew
Reply
Map
View

Click here to load this message in the networking platform