473,473 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Accessing ArrayList Typed object from aspx Error

I am getting this error when trying to add typed object "Questions" to
Arraylist QuestionsList:

Object reference not set to an instance of an object.

--> r.QuestionsList.Add(q);

I tried using r.QuestionsList.Add(q) to add a new instance within the
loop but it does not work. Any help will be appreciated...
namespace Quotes
{
public class Registration : Address
{
public Registration()
{
//
// TODO: Add constructor logic here
//
}

private string _categoryID;
public string categoryID
{
get { return _categoryID; }
set { _categoryID = value; }
}
private ArrayList _QuestionsList;
public ArrayList QuestionsList
{
get { return _QuestionsList; }
set { _QuestionsList = value; }
}

}
}
get_address.aspx

protected void Page_Load(object sender, EventArgs e)
{
// GET QUESTIONS INFO
// Loop PostBack Fields from another page

// Checks if Registration contains previouslly saved data
if (Session["RegistrationInfo"] != null)
{
Registration r = new Registration();
r = (Registration)Session["RegistrationInfo"];

foreach (string sName in Request.Form)
{
if (sName.IndexOf("rc") > -1)
{
Questions q = new Questions();
q.QuestionID = sName;
q.Answer = Request.Form[sName];
r.QuestionsList.Add(q); // *** ERROR HERE

}
}
r = (Registration)Session["RegistrationInfo"];
}
}

namespace Quotes
{
public class Questions
{
public Questions()
{
//
// TODO: Add constructor logic here
//
}

private string _QuestionID;
public string QuestionID
{
get { return _QuestionID; }
set { _QuestionID = value; }
}

private string _Answer;
public string Answer
{
get { return _Answer; }
set { _Answer = value; }
}
}

THANKS

Rod

Mar 31 '06 #1
0 1137

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Stephen | last post by:
I was wondering if someone can help me with an web application design problem. I have a aspx page which builds up an arraylist called addresses and outputs the values in the arraylist items to a...
3
by: Stephen | last post by:
I was wondering if someone can help me with an web application design problem. I have a aspx page which builds up an arraylist called addresses and outputs the values in the arraylist items to a...
11
by: Stephen | last post by:
I was wondering if someone can help me with an web application design problem. I have a aspx page which builds up an arraylist called addresses and outputs the values in the arraylist items to a...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.