Пример #1
0
        void grid_BeforeGetData(object sender, WebGrid.Events.BeforeGetDataEventArgs e)
        {
            if (e.Table == ((Grid)sender).MasterTable)
            {
                BeforeGetDataExecuted++;
                NorthwindEmployeeData employeedata = new NorthwindEmployeeData();

                List <NorthwindEmployee> employees = employeedata.GetAllEmployeesList("", 0, 100);
                e.Table.DataSource = employees;
            }
            else if (e.Table == ((WebGrid.Foreignkey)((Grid)sender).Columns["CustomerType"]).Table)
            {
                e.Table.Columns["CustomerType"].ColumnType = WebGrid.Enums.ColumnType.Number;
                e.Table.Columns["Title"].ColumnType        = WebGrid.Enums.ColumnType.Text;

                WebGrid.Data.Row row = new WebGrid.Data.Row(e.Table);

                row["CustomerType"].Value = 1;
                row["Title"].Value        = "Title";
                e.Table.Rows.Add(row);

                row = new WebGrid.Data.Row(e.Table);
                row["CustomerType"].Value = 2;
                row["Title"].Value        = "Title";
                e.Table.Rows.Add(row);

                row = new WebGrid.Data.Row(e.Table);
                row["CustomerType"].Value = 3;
                row["Title"].Value        = "Title";
                e.Table.Rows.Add(row);
            }
            else if (e.Table == ((WebGrid.Foreignkey)((Grid)sender).Columns["CustomerType2"]).Table)
            {
                NorthwindEmployeeData employeedata = new NorthwindEmployeeData();

                List <NorthwindEmployee> employees = employeedata.GetAllEmployeesList("", 0, 100);
                e.Table.DataSource = employees;
            }
        }
Пример #2
0
        void grid_BeforeGetData(object sender, WebGrid.Events.BeforeGetDataEventArgs e)
        {
            if (e.Table == ((Grid)sender).MasterTable)
            {
                BeforeGetDataExecuted++;
                NorthwindEmployeeData employeedata = new NorthwindEmployeeData();

                List<NorthwindEmployee> employees = employeedata.GetAllEmployeesList("", 0, 100);
                e.Table.DataSource = employees;
            }
            else if (e.Table == ((WebGrid.Foreignkey)((Grid)sender).Columns["CustomerType"]).Table)
            {
                e.Table.Columns["CustomerType"].ColumnType = WebGrid.Enums.ColumnType.Number;
                e.Table.Columns["Title"].ColumnType = WebGrid.Enums.ColumnType.Text;

                WebGrid.Data.Row row = new WebGrid.Data.Row(e.Table);

                row["CustomerType"].Value = 1;
                row["Title"].Value = "Title";
                e.Table.Rows.Add(row);

                row = new WebGrid.Data.Row(e.Table);
                row["CustomerType"].Value = 2;
                row["Title"].Value = "Title";
                e.Table.Rows.Add(row);

                row = new WebGrid.Data.Row(e.Table);
                row["CustomerType"].Value = 3;
                row["Title"].Value = "Title";
                e.Table.Rows.Add(row);
            }
            else if (e.Table == ((WebGrid.Foreignkey)((Grid)sender).Columns["CustomerType2"]).Table)
            {
                NorthwindEmployeeData employeedata = new NorthwindEmployeeData();

                List<NorthwindEmployee> employees = employeedata.GetAllEmployeesList("", 0, 100);
                e.Table.DataSource = employees;
            }
        }