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
185 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying 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
VB.net and sql server 4 45
VB.NET 2008 - SQL Timeout 9 34
Complex SQL statement in VB.NET 7 31
SSRS 2016 Rendering HTML tables 3 29
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 …
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

860 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