public void LoadValidValues(Report rpt) { _validValues = new List <ParameterValue>(); if (_validValuesDS != null) { DataSet ds = rpt.DataSets[_validValuesDS.DataSetName]; if (ds == null) { throw new Exception("Invalid data set " + _validValuesDS.DataSetName + " in ReportParameter"); } if (ds.Fields[_validValuesDS.ValueField] == null) { throw new Exception("Invalid value field " + _validValuesDS.ValueField + " in ReportParameter"); } if (_validValuesDS.LableField != null && ds.Fields[_validValuesDS.LableField] == null) { throw new Exception("Invalid label field " + _validValuesDS.LableField + " in ReportParameter"); } //System.Data.DataSet dsTemp = new System.Data.DataSet(); //ds.Initialize(dsTemp); ds.Reset(); Rdl.Runtime.Context context = new Rdl.Runtime.Context(null, ds, null, null, null); ValidValues.Clear(); while (context.CurrentRow != null) { string value = context.CurrentRow[_validValuesDS.ValueField].ToString(); string label = string.Empty; if (_validValuesDS.LableField != null) { label = context.CurrentRow[_validValuesDS.LableField].ToString(); } ParameterValue pv = new ParameterValue(value, label); if (!_validValues.Contains(pv)) { _validValues.Add(pv); } context.MoveNext(); } } }