private void PopulateForm(List <BaseControl> savedForm)
        {
            for (int i = 0; i < _form.Fields.Count; i++)
            {
                var field = _form.Fields[i];

                if (field.Type == "text" ||
                    field.Type == "numeric" ||
                    field.Type == "decimal" ||
                    field.Type == "document" ||
                    field.Type == "comment")
                {
                    FormFields.Add(new TextControl(field)
                    {
                        Value = (savedForm[i] as TextControl)?.Value
                    });
                }
                else if (field.Type == "date")
                {
                    FormFields.Add(new DateTimeControl(field)
                    {
                        Value = (savedForm[i] as DateTimeControl).Value
                    });
                }
                else if (field.Type == "radio" || field.Type == "dropdown")
                {
                    FormFields.Add(new RadioControl(field)
                    {
                        SelectedIndex = (savedForm[i] as RadioControl).SelectedIndex
                    });
                }
            }
        }
 private void CreateEmptyForm()
 {
     foreach (var field in _form.Fields)
     {
         if (field.Type == "text" ||
             field.Type == "numeric" ||
             field.Type == "decimal" ||
             field.Type == "document" ||
             field.Type == "comment")
         {
             FormFields.Add(new TextControl(field));
         }
         else if (field.Type == "date")
         {
             FormFields.Add(new DateTimeControl(field));
         }
         else if (field.Type == "radio" || field.Type == "dropdown")
         {
             FormFields.Add((new RadioControl(field)));
         }
     }
 }