Solved

Unselected radio button list...

Posted on 2004-08-13
3
819 Views
Last Modified: 2008-02-01
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,
0
Comment
Question by:Weller0123
3 Comments
 
LVL 33

Expert Comment

by:raterus
ID: 11796367
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
 
LVL 15

Accepted Solution

by:
Thogek earned 500 total points
ID: 11796368
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
 
LVL 8

Expert Comment

by:daffodils
ID: 11796442
Thogek has the right bit of code for you..


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now