Solved

Unselected radio button list...

Posted on 2004-08-13
3
834 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
convert html to string 6 38
Regex validation 2 28
Easy filter aspnet 2 24
looking for an ASP.net report designer 4 9
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

839 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