/winforms-dashboard-how-to-manage-dashboard-parameters-in-code

This example shows how to override an initial or user-defined dashboard parameter value by changing it in the CustomParameters event handler.

Primary LanguageVisual Basic .NETOtherNOASSERTION

Dashboard for WinForms - How to manage dashboard parameters in code

This example shows how to change a default or user-defined dashboard parameter value in the DashboardViewer.CustomParameters event handler. The effective parameter value is hidden from users. Set the Visible property to false to hide the parameter from the Dashboard Parameters dialog.

In this example, the parameterState dashboard parameter with static look-up settings is added to the dashboard. This dashboard parameter is used to filter the data source. The Dashboard Parameters dialog displays the values and enables users to select a parameter value from the list. In the DashboardViewer.CustomParameters) event handler, we can change the value supplied by the user before it is passed to the query. In the result, the value defined in the DashboardViewer.CustomParameters event is in effect.

C#

private void DashboardViewer_CustomParameters(object sender, CustomParametersEventArgs e) {
	var customParameter = e.Parameters.FirstOrDefault(p => p.Name == "parameterState");
	if (customParameter != null) {
		// Actual value used when retrieving data from the data source.
		customParameter.Value = "Nevada";
	}
}

Visual Basic

Private Sub DashboardViewer_CustomParameters(ByVal sender As Object, ByVal e As CustomParametersEventArgs)
	Dim customParameter = e.Parameters.FirstOrDefault(Function(p) p.Name = "parameterState")
	If customParameter IsNot Nothing Then
		' Actual value used when retrieving data from the data source.
		customParameter.Value = "Nevada"
	End If
End Sub

Files to Review

Documentation

More Examples

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)