Good morning,
I am having an issue with reporting and getting the selected value of a databound combobox. The value only returns the selectedItem.Text of the combobox and I wish to get the selectedValue instead.
Could you let me know what the code would be to achieve this please?
The Lists are defined as:
and then they are assigned to the parameters as below:
Then I bind the report as follows:
pType and pPeriodCount only grab the selected item. I have tried searching the forums and reading documentation but I can not find anything that explains how to get the selected value.
Any help would be appreciated.
cheers,
Jaymie
I am having an issue with reporting and getting the selected value of a databound combobox. The value only returns the selectedItem.Text of the combobox and I wish to get the selectedValue instead.
Could you let me know what the code would be to achieve this please?
The Lists are defined as:
Public Shared Function ReturnTypes() As ForecastTypeCollection |
Dim pTypeCol As New ForecastTypeCollection |
For i As Integer = 0 To 2 |
Dim pType As New ForecastType |
Select Case i |
Case 0 |
With pType |
.ValueMember = "Both" |
.DataMember = "" |
End With |
Case 1 |
With pType |
.ValueMember = "UK" |
.DataMember = "UK" |
End With |
Case 2 |
With pType |
.ValueMember = "International" |
.DataMember = "EX" |
End With |
End Select |
pTypeCol.Add(pType) |
Next |
Return pTypeCol |
End Function |
Public Shared Function ReturnPeriods() As PeriodCollection |
Dim p As New PeriodCollection |
For i As Integer = 1 To 12 |
Dim pPeriod As New Period |
With pPeriod |
.DataMember = i |
.ValueMember = i |
End With |
p.Add(pPeriod) |
Next |
Return p |
End Function |
and then they are assigned to the parameters as below:
Public Sub New() |
InitializeComponent() |
Report.ReportParameters()(0).UI.AvailableValues.DataSource = ReturnTypes() |
Report.ReportParameters()(0).UI.AvailableValues.DataMember = "DataMember" |
Report.ReportParameters()(0).UI.AvailableValues.ValueMember = "ValueMember" |
Report.ReportParameters()(1).UI.AvailableValues.DataSource = ReturnPeriods() |
Report.ReportParameters()(1).UI.AvailableValues.DataMember = "DataMember" |
Report.ReportParameters()(1).UI.AvailableValues.ValueMember = "ValueMember" |
End Sub |
Then I bind the report as follows:
Private Sub ForecastNextPeriod_NeedDataSource(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.NeedDataSource |
Try |
Dim pCalendar As Calendar = ReturnCurrentYearAndPeriod() |
Dim pType As String = ReportParameters("Type").Value |
Dim pPeriodCount As Integer = Me.ReportParameters("PeriodCount").Value |
DirectCast(sender, Telerik.Reporting.Processing.Report).DataSource = ReturnForecastReport(pPeriodCount, pCalendar.Period, pCalendar.Year, pType) |
Catch ex As Exception |
MsgBox(ex.ToString) |
End Try |
End Sub |
pType and pPeriodCount only grab the selected item. I have tried searching the forums and reading documentation but I can not find anything that explains how to get the selected value.
Any help would be appreciated.
cheers,
Jaymie