Hi, someone can help me please. I've a XamDataGrid so i want to get data when i select row. I don't know how to proceed. Anyway the method, for example show the cols result with a MessageBox. Thanks for advance.
Hi,
Thank you for your post. I have been looking into your requirement and my suggestion is to handle the ‘RecordActivated’ event of the XamDataGrid and access the data item like e.g.:
private void xamDataGrid1_RecordActivated(object sender, Infragistics.Windows.DataPresenter.Events.RecordActivatedEventArgs e)
{
var dataItem = (e.Record as DataRecord).DataItem;
}
Let me know, if you need any further assistance on this matter.
I've problem with "DataRecord" (could not be found) ... ?
And the second, i want to get the value cols for e.g. in the first row that i select i want to get the name column. Thanks
Hi Skatox,
Thank you for reply. I have been looking into your requirement and the easiest way to achieve this functionality is casting the DataItem to the underlying type like e.g.:
var dataItem = (e.Record as DataRecord).DataItem as Worker;
MessageBox.Show("Person Name: " + dataItem.Name);
I am attaching a sample application(DataGridFunc.zip) that shows it.
i see it. thx....
Thank you for your replies. Let me know, if you need any further assistance on this matter.
I've seen the attache files so, that's i want but for me the xamdatagrid values is from Mysql table... i have this code for query all i need :
private void loadDataToGrid() { InternshipEntities entities = new InternshipEntities(); var data = from x in entities.clients select new { x.nom_client, x.prenom_client, x.adresse_client, x.telephone_client, x.nationalite_client }; if (data != null) { datagridClient.DataSource = data.ToList(); } }
Question : HOW CAN I PROCEED WITH IT ? THE AIM IS THE SAME ABOVE. THX
Thank you for your replies. I have been looking into your new question and you need to do the same as before. You need to access the data item of the underlying data for the particular record, cast is to your ‘client’ object and access its desired properties.
Let me know, if you need any further assistance on this.
But DataItem return null whrn i try to get clients.nom_client ? All clients properties are there but return nothing...
I've this and i've the next problem :
private void datagridClient_RecordActivated(object sender, Infragistics.Windows.DataPresenter.Events.RecordActivatedEventArgs e){ var dataItem = (e.Record as DataRecord).DataItem as clients; MessageBox.Show("=> "+dataItem.nom_client); <=========== here is the problem (no instance ....)}
Thank you Yanko but my problem is solved. Best regrds
Thank you for your reply. I am glad that you have managed to resolve this issue.