Hello,
I have a DataGrid which has some Fields, and I want to access the value of each cell in Field for conditioning some comboboxes. The question is: How can I do that ?
I've read some post about taking the value inside a cell and also how to activate each cell. But the read cells were inside the XamDataGrid directly and not in Fields in XamDataGrid.
Any ideas how to do it?
Thanks.
Hello Priya,
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
Hi Stefan,
It worked.
Thanks a lot.
Regards,
Priya
Thank you for your post. I have been looking into it and I can say that yo uare able to get the selected Field's Name trough the SelectedItems collection, but if you want to change all the Cell's Values you have to iterate all the Records. You can do it like this:
foreach (var item in xamDataGrid1.Records) { (item as DataRecord).Cells[xamDataGrid1.SelectedItems.Fields[0]].Value = "new value"; }
How to access cells if column is selected at run time?
I can't find any property for xamDataGrid.SelectedItems.Fields' name...
My requirement is I want to edit all the cells in the column selected on Modify button click...
Please help! It's urgent.
I have been looking into your issue and though there are no values actually located in the Fields themselves here is a way to get the cells from a single Field. You can iterate through all the DataRecords which represent the DataItems and get the value from the Cell that is associated with specified Field. Here is a code snippet that should e useful:
foreach (DataRecord record in xamDataGrid1.Records)
{
var value = record.Cells["salary"].Value;
}
This will go through all values from your “salary” field.
Hope this helps. Please let me know if you require any further assistance on the matter.
Sincerely,
Petar Monov
Developer Support Engineer
Infragistics Bulgaria
www.infragistics.com/support