All valueboxes in a row getting time from a datetimepicker
Hi
Today I have datetimepickers scripted towards valueboxes in a grid. One datetimepicker for each row in the grid. The grid as it is today is 7 columns and 20 rows. The number of columns and rows change based on criteria in the ongoing test.
I am looking for a way to set the grid up more dynamically then what I currently have. That way I could have a maximum of rows needed scripted, and the operators would be able to change the size of the grid without an admin changing the script.
Does anyone have a way for the datetimepickers to each update all valueboxes in a given gridrow?
4 replies
-
Hi ,
I don't have anything as of right now that updates a single row in a grid, but if I come up with something I will pass it along. As of right now, I only have this example which updates ALL valueboxes within a given screen: https://helpcenter.canarylabs.com/moderate/t/60yzpbn/update-value-boxes-based-on-timedate
-
,
Try this. In my example I have two DateTime Pickers that update two different grid rows [0] and [1] of Grid1.
public void DateTimePicker1_OnDateTimeChange(object sender, DateTime dateTime) { var aggregateStartTime = dateTime.ToString("o"); ControlGridRow gridRow = (ControlGridRow)Grid1.Children[0]; foreach (var control in gridRow.Children) { if (control is ControlValueBox valueBox) { valueBox.AggregateStartTime = aggregateStartTime; } } } public void DateTimePicker2_OnDateTimeChange(object sender, DateTime dateTime) { var aggregateStartTime = dateTime.ToString("o"); ControlGridRow gridRow = (ControlGridRow)Grid1.Children[1]; foreach (var control in gridRow.Children) { if (control is ControlValueBox valueBox) { valueBox.AggregateStartTime = aggregateStartTime; } } }