using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Telerik.WinControls.UI;

namespace DataEntry
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            //RadGridView
            radGridView1.Columns.Add("Item");
            radGridView1.Columns.Add("Value");
            radGridView1.Columns.Add("Type");
            radGridView1.Columns.Add("Options");

            List<string[]> list= new List<string[]>();
            list.Add(new string[] { "Result", "DropDown", "Pass,Failed" });
            list.Add(new string[] { "UserId", "Text", "" });

            int index = 0;
            foreach(string[] s in list)
            {
                radGridView1.Rows.Add(s[0], "", s[1], s[2]);
                switch(s[1])
                {
                    case "DropDown":
                        var selection = s[2].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
                        break;
                }
                index++;
            }


            //DataGridView
            dataGridView1.Columns.Add("Item", "Item");
            dataGridView1.Columns.Add("Value", "Value");
            dataGridView1.Columns.Add("Type", "Type");
            dataGridView1.Columns.Add("Options", "Options");

            list = new List<string[]>();
            list.Add(new string[] { "Result", "DropDown", "Pass,Failed" });
            list.Add(new string[] { "UserId", "Text", "" });
            index = 0;
            foreach (string[] s in list)
            {
                dataGridView1.Rows.Add(s[0], "", s[1], s[2]);
                switch (s[1])
                {
                    case "DropDown":
                        DataGridViewComboBoxCell cmb = new DataGridViewComboBoxCell();
                        var selection = s[2].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
                        cmb.DataSource = selection;
                        this.dataGridView1.Rows[index].Cells[1] = cmb;
                        break;

                    case "Text":
                        this.dataGridView1.Rows[index].Cells[1].Value = "Text Field";
                        break;
                }
                index++;
            }
        }
    }
}
