This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
/
Form1.cs
54 lines (50 loc) · 1.63 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace FilteringRepeatRows
{
public partial class Form1 : Form
{
List<string>[] filterFields = new List<string>[2];
FilterHelper helper;
public Form1()
{
InitializeComponent();
List<string> fields = new List<string>();
fields.Add("Name");
fields.Add("Company");
fields.Add("Address");
filterFields[0] = null;
filterFields[1] = fields;
helper = new FilterHelper(gridView1);
radioGroup1.SelectedIndex = 0;
gridControl1.DataSource = CreateTable(20);
}
DataTable CreateTable(int rowCount)
{
DataTable table = new DataTable();
table.Columns.Add("Name");
table.Columns.Add("Company");
table.Columns.Add("Age", typeof(int));
table.Columns.Add("Address");
int repeatCount = 3;
for (int i = 0; i < rowCount; i++)
{
for (int j = 0; j < repeatCount; j++)
{
table.Rows.Add(new object[] { String.Format("Name{0}", i), String.Format("Company{0}", i), 25 + i * repeatCount + j, String.Format("Address{0}", i) });
}
}
return table;
}
private void radioGroup1_SelectedIndexChanged(object sender, EventArgs e)
{
helper.Fields = filterFields[radioGroup1.SelectedIndex];
}
}
}