Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 373013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:15:59+00:00 2026-05-12T14:15:59+00:00

Working on a Online Test. I have 3 tables Questions Subject Topic I have

  • 0

Working on a Online Test.

I have 3 tables

  1. Questions
  2. Subject
  3. Topic

I have made a stored procedure which returns 25 random records. I want to store it in-memory and then display 1 question at a time with AJAX. I don’t want to hit database 25 times as there are many users, I tried and store the result in viewstate but then I am not able to cast it back. if I use

Dim qus = from viewstate("questions") 

it works, but it doesn’t work when I retrieve 1 record at a time.

Code:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Not Page.IsPostBack Then
        ViewState.Add("QuestionNo", 0)
        Dim qus = From q In PML.PM_SelectRandomQuestionFM Select q
        viewstate.add("questions",qus)
        LoadQuestion(0)
    End If
End Sub



Private Sub LoadQuestion(ByVal i As Integer)
    Dim QuestionNo As Integer = CType(ViewState("QuestionNo"), Integer) + 1

    Try
        If QuestionNo <= 25 Then

            Dim qus = viewstate("questions")

            Me._subjectTopic.Text = String.Format("<b>Subject:</b> {0} -- <b>Topic:</b> {1}", qus(i).subjectName, qus(i).TopicName)
            Me._question.Text = " " & qus(i).Question
            Me._answer1.Text = " " & qus(i).Answer1
            Me._answer2.Text = " " & qus(i).Answer2
            Me._answer3.Text = " " & qus(i).Answer3
            Me._answer4.Text = " " & qus(i).Answer4
            Me._questionNo.Text = String.Format("Question No. {0} / 25", QuestionNo)
            ViewState.Add("QuestionNo", QuestionNo)
        Else
            Server.Transfer("freeMemberResult.aspx")
        End If

    Catch ex As Exception
        Throw New System.Exception(ex.ToString)
    End Try
End Sub

I tried casting the object to

Dim qus = CType(ViewState("questions"), IQueryable(Of PM_SelectRandomQuestionFMResult)) 

but then I get this error

System.Linq.Enumerable+WhereSelectEnumerableIterator`2

Please HELP or if there is any other method to do it, if my method of doing online test is wrong.

Regards

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T14:16:00+00:00Added an answer on May 12, 2026 at 2:16 pm

    IMO, you’re over-engineering this. Why screw around trying to hold the data in memory? Why not write each question to a div, and then hide all of the question divs except for the “current question”.

    Much easier to implement and you’re not hitting the server with several AJAX calls, This also make saving state (previously answered questions, etc) much, much easier.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on online pdf library project. In this I have a feature
I am working on a online shopping website, it will have product images also.
I'm working on a online quiz client where we use a dedicated custom-made linux
I'm working on an online forex trading system and a while back we have
I am working on project -online file management where we have to tore file
I'm working on an online store. I have it setup on my testing server.
i am working on a online file management project.In which we are storing references
I have the tables question, topic and question_has_topic (many-to-many relationship). In my application admins
I have a stupid question :) I'm working on a simple php document which
I'm working on a web site which creates images online ... there is an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.