Solved

Is there a way of selecting all the remaining questions automatically from a radiolist? (with the Incorrect answer)

Posted on 2004-10-12
3
191 Views
Last Modified: 2010-04-23
Suppose I want to remove page validation on an exam to let the page automatically update the datasource based on a timer. The problem here is that some users may not have answered all questions before the page updates. This will result in some of the Radiobutton.selecteditem.text/values being returned as blank. This is the problem. I am getting the error cannot be set to null object.

Is there a way of selecting all the remaining questions automatically from a radiolist? (with the Incorrect answer)

The datavaluefield is what contains the correct or Incorrect values.

Any suggestions?

Im using VB.NET
0
Comment
Question by:pgilfeather
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
bramsquad earned 500 total points
ID: 12288897
i posted this after you accepted the answer to the question i helped you with, have you tried this...

For nCount = 0 To RadioButtonList.Items.Count - 1
      If RadioButtonList.Items(nCount).Selected = False Then
             RadioButtonList.Items(nCount).Value = "NoSelectedValue"
      End if
Next

~b
0
 
LVL 10

Expert Comment

by:Hans Langer
ID: 12291417
Do you have more than 1 RadioButtonList in a page , or just 1 for each page ?


For the code of you can add

if  not RadioButtonList.SelectedItem Is Nothing then
For nCount = 0 as integer To RadioButtonList.Items.Count - 1
      If RadioButtonList.Items(nCount).Selected = False Then
             RadioButtonList.Items(nCount).Value = "NoSelectedValue"
      End if
Next
0
 
LVL 10

Expert Comment

by:Hans Langer
ID: 12291464
Sorry , Problem with the connection,

Do you have more than 1 RadioButtonList in a page , or just 1 for each page ?

Try This

      If Not RadioButtonList .SelectedItem Is Nothing Then  ' that mean RadioButtonList have not SelectedItem
         For MyIndex As Integer = 0 To RadioButtonList .Items.Count - 1
            If RadioButtonList .Items(MyIndex ).Value = "NoSelectedValue" Then
               RadioButtonList .Items(MyIndex ).Selected = True
               Exit For
            End If
         Next
      End If

GL
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

749 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