How can I bind elements with dynamic, user-defined names in a record to my GridDataControl ?
Thanks for contacting Syncfusion Support.
In GridDataControl you can achieve your requirement by using the Indexer property binding on GridColumn MappingName. We have prepared a sample as per your requirement and you can download the same form the below location,
Sample : http://www.syncfusion.com/downloads/support/forum/121811/ze/Indexer_Binding_Demo-1971808909
Regards,
Sowndaiyan
var col1 = new GridDataVisibleColumn();
col1.HeaderText = "Machine";
col1.MappingName = "Machine";
runDataGrid.VisibleColumns.Add(col1);
var col2 = new GridDataVisibleColumn();
col2.Binding = new Binding("{Binding Path=RunValues[Country].Value,Mode=TwoWay}");
col2.HeaderText = "Country";
col2.MappingName = "RunValues[Country].Value";
runDataGrid.VisibleColumns.Add(col2);
In GridDataControl, you can achieve the Indexer property binding in code behind like the below code example,
C#
|
Binding colbinding = new Binding();
colbinding.Path = new PropertyPath("ShipDetails[ShipCountry].Value");
colbinding.Mode = BindingMode.TwoWay;
col2.Binding = colbinding;
col2.HeaderText = "ShipCountry1";
col2.MappingName = "ShipDetails[ShipCountry].Value";
dataGrid.VisibleColumns.Add(col2); |
Regards,
Sowndaiyan
Thanks for the update.
Please let us know if you need further assistance.
Regards,
Sowndaiyan
- 5 Replies
- 2 Participants
-
SM Steve McWilliams
- Jan 27, 2016 08:04 PM UTC
- Feb 2, 2016 03:42 AM UTC