Design-Time Features > Server-Side Filtering |
We already mentioned that it is generally desirable to restrict the data returned from the server to the client, and we demonstrated how C1DataSource facilitates this with the use of the FilterDescriptor Collection Editor. Now we’ll demonstrate how to provide the end user with the means to achieve server-side filtering.
The user will select a Product Category from a combo box, for example, although other GUI controls can be used, and that will load a DataGrid with new data from the server.
To implement server-side filtering, follow these steps:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Private Sub comboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) c1DataSource1.ViewSources("Products").FilterDescriptors(0).Value = comboBox1.SelectedValue End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { c1DataSource1.ViewSources["Products"].FilterDescriptors[0].Value = comboBox1.SelectedValue; } |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
dataGridView1.AutoGenerateColumns = True |
To write code in C#
C# |
Copy Code
|
---|---|
dataGridView1.AutoGenerateColumns = true; |