473,387 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Writing arraylist items to the page

I've been working on some code which will hopefully allow me to transfer the
contents of an arraylist on one page over to another page. The Arraylist is
held in the viewstate object as it is populated on the on-click event of a
button. Im trying to move to another page and carry over the items in my
arraylist and write them to the page. The code ive been trying to work with
to achieve is detailed below. I am getting an error and im not sure exactly
why or what im doing wrong and was wondering if someone could have a look and
help me with this. To see exactly how my Arraylist is populated please see
my recent post. I've been advised to use the Server.Transfer to access the
arraylist on a seperate page, however as outlined below i've having some
difficulty achieveing this. Could someone please help me. Thanks

Im getting an error: -
Object reference not set to an instance of an object.
For the line
foreach (object o in debtor_enquiry.addresses)
in the page load event below.

Contained within the page where the ArrayList has been created. addresses is
the name of my arraylist.
private ArrayList Addresses1;
public ArrayList addresses
{
get
{
return Addresses1;
}
}

private void ArrayList_Click(object sender, System.EventArgs e)
{
Server.Transfer("ArrayListItemsDisplayed.aspx");
}

private void Page_Load(object sender, System.EventArgs e)
{
WebForm1 debtor_enquiry = base.Context.Handler as WebForm1;
if (null != debtor_enquiry)
{
// Add the logic here
foreach (object o in debtor_enquiry.addresses)
{
Response.Write(o.ToString());
}
}
}
Jul 21 '05 #1
3 1439
Have you tried the code i posted?
It works.
--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Stephen" <St*****@discussions.microsoft.com> wrote in message
news:63**********************************@microsof t.com...
I've been working on some code which will hopefully allow me to transfer
the
contents of an arraylist on one page over to another page. The Arraylist
is
held in the viewstate object as it is populated on the on-click event of a
button. Im trying to move to another page and carry over the items in my
arraylist and write them to the page. The code ive been trying to work
with
to achieve is detailed below. I am getting an error and im not sure
exactly
why or what im doing wrong and was wondering if someone could have a look
and
help me with this. To see exactly how my Arraylist is populated please
see
my recent post. I've been advised to use the Server.Transfer to access
the
arraylist on a seperate page, however as outlined below i've having some
difficulty achieveing this. Could someone please help me. Thanks

Im getting an error: -
Object reference not set to an instance of an object.
For the line
foreach (object o in debtor_enquiry.addresses)
in the page load event below.

Contained within the page where the ArrayList has been created. addresses
is
the name of my arraylist.
private ArrayList Addresses1;
public ArrayList addresses
{
get
{
return Addresses1;
}
}

private void ArrayList_Click(object sender, System.EventArgs e)
{
Server.Transfer("ArrayListItemsDisplayed.aspx");
}

private void Page_Load(object sender, System.EventArgs e)
{
WebForm1 debtor_enquiry = base.Context.Handler as WebForm1;
if (null != debtor_enquiry)
{
// Add the logic here
foreach (object o in debtor_enquiry.addresses)
{
Response.Write(o.ToString());
}
}
}

Jul 21 '05 #2
Yeah sorry, was at lunch and just received it there now. got it to working in
a test app but can't get it to work for the way I have things set up. I
emailed you my code behind pages and would really appreciate it if you could
have a quick look. Sorry for bugging you I'm relatively new to programming
and have been thrown in at the deep end, but I really enjoy it and I'm
learning new stuff every day. Thanks for your help again. If your ever over
in Belfast I'll but you a beer!!

"Dennis Myrén" wrote:
Have you tried the code i posted?
It works.
--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Stephen" <St*****@discussions.microsoft.com> wrote in message
news:63**********************************@microsof t.com...
I've been working on some code which will hopefully allow me to transfer
the
contents of an arraylist on one page over to another page. The Arraylist
is
held in the viewstate object as it is populated on the on-click event of a
button. Im trying to move to another page and carry over the items in my
arraylist and write them to the page. The code ive been trying to work
with
to achieve is detailed below. I am getting an error and im not sure
exactly
why or what im doing wrong and was wondering if someone could have a look
and
help me with this. To see exactly how my Arraylist is populated please
see
my recent post. I've been advised to use the Server.Transfer to access
the
arraylist on a seperate page, however as outlined below i've having some
difficulty achieveing this. Could someone please help me. Thanks

Im getting an error: -
Object reference not set to an instance of an object.
For the line
foreach (object o in debtor_enquiry.addresses)
in the page load event below.

Contained within the page where the ArrayList has been created. addresses
is
the name of my arraylist.
private ArrayList Addresses1;
public ArrayList addresses
{
get
{
return Addresses1;
}
}

private void ArrayList_Click(object sender, System.EventArgs e)
{
Server.Transfer("ArrayListItemsDisplayed.aspx");
}

private void Page_Load(object sender, System.EventArgs e)
{
WebForm1 debtor_enquiry = base.Context.Handler as WebForm1;
if (null != debtor_enquiry)
{
// Add the logic here
foreach (object o in debtor_enquiry.addresses)
{
Response.Write(o.ToString());
}
}
}


Jul 21 '05 #3
I hope you got the last mail i sent.
--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Stephen" <St*****@discussions.microsoft.com> wrote in message
news:45**********************************@microsof t.com...
Yeah sorry, was at lunch and just received it there now. got it to working
in
a test app but can't get it to work for the way I have things set up. I
emailed you my code behind pages and would really appreciate it if you
could
have a quick look. Sorry for bugging you I'm relatively new to
programming
and have been thrown in at the deep end, but I really enjoy it and I'm
learning new stuff every day. Thanks for your help again. If your ever
over
in Belfast I'll but you a beer!!

"Dennis Myrén" wrote:
Have you tried the code i posted?
It works.
--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Stephen" <St*****@discussions.microsoft.com> wrote in message
news:63**********************************@microsof t.com...
> I've been working on some code which will hopefully allow me to
> transfer
> the
> contents of an arraylist on one page over to another page. The
> Arraylist
> is
> held in the viewstate object as it is populated on the on-click event
> of a
> button. Im trying to move to another page and carry over the items in
> my
> arraylist and write them to the page. The code ive been trying to work
> with
> to achieve is detailed below. I am getting an error and im not sure
> exactly
> why or what im doing wrong and was wondering if someone could have a
> look
> and
> help me with this. To see exactly how my Arraylist is populated please
> see
> my recent post. I've been advised to use the Server.Transfer to access
> the
> arraylist on a seperate page, however as outlined below i've having
> some
> difficulty achieveing this. Could someone please help me. Thanks
>
> Im getting an error: -
> Object reference not set to an instance of an object.
> For the line
> foreach (object o in debtor_enquiry.addresses)
> in the page load event below.
>
> Contained within the page where the ArrayList has been created.
> addresses
> is
> the name of my arraylist.
> private ArrayList Addresses1;
> public ArrayList addresses
> {
> get
> {
> return Addresses1;
> }
> }
>
> private void ArrayList_Click(object sender, System.EventArgs e)
> {
> Server.Transfer("ArrayListItemsDisplayed.aspx");
> }
>
> private void Page_Load(object sender, System.EventArgs e)
> {
> WebForm1 debtor_enquiry = base.Context.Handler as WebForm1;
> if (null != debtor_enquiry)
> {
> // Add the logic here
> foreach (object o in debtor_enquiry.addresses)
> {
> Response.Write(o.ToString());
> }
> }
> }


Jul 21 '05 #4

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

Similar topics

4
by: Stephen | last post by:
I have got an event below to remove items from an arraylist and then to rebind the arraylist to the datagrid subsequently deleting the appropriate row. My problem is that my code makes sense and I...
10
by: Eric | last post by:
I'm looking at this page in the MSDN right here: ms-help://MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemcollectionsarraylist classsynchronizedtopic2.htm (or online here:...
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...
2
by: Stephen | last post by:
I have code which checks whether a datagrid is empty and if it is it shows a panel on my page. If its not empty then Im using the server.transfer to go to another page so as im able to use the...
5
by: Tim | last post by:
Hi, I am creating a printing engine and I am cycling though my recordset. Each item gets added to an ArrayList. Once there are more items that will fit on the page I add the item ArrayList to a...
7
by: Dave | last post by:
Hi all, I have... using System.Collections; namespace MyApp.Templates { public class MyPage : System.Web.UI.Page { ArrayList MyArray = new ArrayList();
4
by: Alan Silver | last post by:
Hello, I'm trying to use an ArrayList to do data binding, but am getting an error I don't understand. I posted this in another thread, but that was all confused with various other problems,...
5
by: Stimp | last post by:
I'm populating a dropdown list with non-consecutive values (well the last 3 values are non-consecutive anyway).. What's a shorter way of writing the following?... ddLetMaxPrice.Items.Insert(0,...
3
by: Stephen | last post by:
I've been working on some code which will hopefully allow me to transfer the contents of an arraylist on one page over to another page. The Arraylist is held in the viewstate object as it is...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.