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
159 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
  • 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

757 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

21 Experts available now in Live!

Get 1:1 Help Now