Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Catch multi select in datagrid
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01019158
Message ID:
01020227
Vues:
21
>>I just was told that I have to do multi selects in a WIN sales form where I can pick a few items out of inventory. Think of a package sale where your getting 5 items for a set price that is defined at the checkout station and probably won't be duplicated ever again.
>>
>>In my mind I'd like to have a textbox display the chosen items as they are Ctrl + clicked so the user can see items that are out of sight on the grid.
>>
>>How do a catch that event?
>
>We have added a SelectedRowCountChanged event to mmDataGrid so you can create a handler for this event.
>
>Regards,


Unfortunatly it's mislabeled. It's not the SelectedRowCount, it should be the TouchedRowCount.

My code:
//Display what is multi selected
if (this.mmDataGrid1.SelectedRows.Count >1)
{
// array to hold my part # for display
int[] a = new int[ this.mmDataGrid1.SelectedRows.Count];
int rn =0;
// strings for filling that are passed back for display to user
string box = "", comm ="";
// grab the data
for (int i =0 ; i < mmDataGrid1.SelectedRows.Count; i++)
{
rn = Convert.ToUInt16(mmDataGrid1.SelectedRows[i].ToString());
a[i] = Convert.ToUInt16(this.dsMerch.Tables[0].Rows[rn]["GMAsset"].ToString());
box = box + comm +this.dsMerch.Tables[0].Rows[rn]["GMAsset"].ToString();
if (i ==0)
{
comm = ", ";
}
}
this.mmTextBox1.Text= box;
this.mmTextBox1.Refresh();
}

here is an image showing a few pieces of inventory with only one selected but my display box shows 3 records that were touched.

http://www.lotmate.com/images/amult.JPG

Any ideas?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform