Link to home
Start Free TrialLog in
Avatar of ICantSee
ICantSeeFlag for United States of America

asked on

Accessing the value of a RadioButtonList that is in a template field

I have an app that allows our staff to submit client referrals. I'm currently working on a management page that allows the resposible staff member to manage the referrals and send them to the correct staff member / department. The page is written in VB and has a sql back end.

I have a detailsview with a number of template fields. The one I am interested in is the Assigned To RadioButtonList. I have configured it so that its text is the staff member's name and its value is thier email address.

In the next row I have a dropdown list that is supposed to display the email address of the selected staff member based on the selected value of the Assigned To Radiobuttonlist.selectedvalue.

I normally just use the datasource wizard and base a where clause on a control, but when I try this when the control is in a template field it is not listed in the available controls.

Does anyone know how to have my control added to the list or know of another way of doing this?
User generated image
I've also tried the following code with no success:

If ReferralsManagementDV.CurrentMode = DetailsViewMode.Edit Then
            Dim ReferralAssignedToRBL As RadioButtonList = DirectCast(ReferralsManagementDV.FindControl("ReferralAssignedToRBL"), RadioButtonList)
            Dim ReferralAssignedToEmail As TextBox = DirectCast(ReferralsManagementDV.FindControl("ReferralAssignedToEmailTB"), TextBox)
            If (ReferralAssignedToRBL.SelectedValue) IsNot Nothing Then
                ReferralAssignedToEmail.Text = ReferralAssignedToRBL.SelectedValue.ToString
            End If

            SendStatusUpdateButton.Visible = False
            CloseTicketButton.Visible = False

        End If

Open in new window


I receive the "'ReferralAssignedToRBL' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value error when I click the edit button.
ASKER CERTIFIED SOLUTION
Avatar of sammySeltzer
sammySeltzer
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial