views:

728

answers:

1

Hi there, this is my escenary, I Have a class called Plantilla that contains severals propertyes that allows bind a gridview in wpf, so that was working already, but users tells me that they need re-group the query by some field in database, so I prepare this snippet :

  var dsTemplates = (from t in db.PLANTILLAs
                                   join q in db.EQUIPOs on t.codigoequipo equals q.codigoequipo
                                   where t.codigoestudio.Substring(5, 1).Equals(codigoModalidad)
                                   orderby t.tituloplantilla
                                   group new Plantilla
                                   {
                                       codigoplantilla = t.codigoplantilla,
                                       codigoequipo = t.codigoequipo,
                                       nombreequipo = q.nombreequipo,
                                       codigoestudio = t.codigoequipo,
                                       conclusion = t.conclusion,
                                       hallazgo = t.hallazgo,
                                       nombreexamen = t.tituloplantilla,
                                       tecnica = t.tecnica
                                   } by t.codigoestudio
                ).ToList();
                formTemplates.dlstPlantillas.ItemsSource = dsTemplates;
                db.Connection.Close();

Now my issue is how can I read the following? in Hashtable? how can I cast a generic to a Hashtable? cause I have now a List when T is my class Plantilla

I binded it to a gridview so when I want to get the values from grid Im getting exception

debug shows me this is my new type of Collection in gridview.SelectedItems[0];

[0] = {System.Data.Linq.SqlClient.ObjectReaderCompiler.Group<string,Demo.View.Plantilla>}
+1  A: 

In your gridview you can set the index field to be the required field in your returned var. This will then provide you with a PK for each row that is edited.

ck
Im using WPF, with Grid and ListView where can I find that property?
Angel Escobedo