0

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

null
    • smason
    • 3 wk ago
    • Reported - view

    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

    • smason
    • 3 wk ago
    • Reported - view

    ,

    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;
                }
            }
        }
    
      • hbjorsvik
      • 3 wk ago
      • Reported - view

       ,

      Thank you for your reply. Unfortunately I am getting an error CS1644; 'type pattern matching' cannot be used because it is not part of the C#6.0 language specification. Tried with your earlier post you linked to for all boxes on the screen with same result.
      It might be that we are on different versions of the system than you. Our servers are on v23
       

      • smason
      • 2 wk ago
      • Reported - view

      That would definitely be the reason why. Most of the services in v24 (including Axiom) require .NET 8 framework. Version 23 ran on .NET 4.7.1.

Content aside

print this pagePrint this page
  • 2 wk agoLast active
  • 4Replies
  • 27Views
  • 3 Following