Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
430
How to know which Radio Button in UltraOptionset Clicked
posted

Hi,

In my application i have a form where user's information is there i can edit the information from there.One Property in that form is "IsLocked" this determines if ther user is locked from login or not.

To show this i've used Option Set Control with two radio button in it (1) Yes (2) No.

If user is locked when this form gets loaded it will show Yes button selected.

My Problem is when the Administrator will click on "No" Radio Button to set the user unlock how will i know that he has clicked on "No".

i have tried optionset.IsCheckedItem.ToString

Coz' if the user is Locked then "yes" will be selected now when admin click on "No" the above line will give me "Yes" button.

 

How can i know which radio button got clicked??

Parents
No Data
Reply
  • 3565
    Verified Answer
    posted

    If you have set the DataValue property for the Yes and No option items in your list you can access the option control's value property during the Value Changed event to see which one has been selected by the user. I prefer to do it in a more agnostic way not actually hard coding the option values, but instead just knowing the index of each option.

        Private Sub UltraOptionSet1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UltraOptionSet1.ValueChanged
            Dim Editor = TryCast(sender, Infragistics.Win.UltraWinEditors.UltraOptionSet)
            If Editor IsNot Nothing Then
                'Determine the value selected
                Select Case Editor.Value.ToString
                    Case Editor.Items(0).DataValue 'Yes
                        'Do Something
                    Case Editor.Items(1).DataValue 'No
                        'Do Something
                End Select
            End If
        End Sub

Children