Unselected radio button list...

When using the following if statement, it works fine if one of hte items is selected...

I'm crashing if none of the radio buttons are selected.

If (rblPart.SelectedItem.Text = "Make Part") Then

Ideas???

Thanks,
Weller0123Asked:
Who is Participating?
 
ThogekConnect With a Mentor Commented:
Well, you're trying to access the SelectedItem, which would be a problem is no item is selected....

Perhaps

    If (rblPart.SelectedIndex <> -1) Then
        If (rblPart.SelectedItem.Text = "Make Part") Then
0
 
raterusCommented:
SelectedItem is a reference to the selected listitem, if there isn't a selected value, this is null, which is why you are getting the error.  You need to check to see if this is null or nothing first, then act accordingly
0
 
daffodilsCommented:
Thogek has the right bit of code for you..


0
All Courses

From novice to tech pro — start learning today.