473,781 Members | 2,732 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.EventArg s e)
{
Server.Transfer ("ArrayListItem sDisplayed.aspx ");
}

private void Page_Load(objec t sender, System.EventArg s e)
{
WebForm1 debtor_enquiry = base.Context.Ha ndler 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 1470
Have you tried the code i posted?
It works.
--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Stephen" <St*****@discus sions.microsoft .com> wrote in message
news:63******** *************** ***********@mic rosoft.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.EventArg s e)
{
Server.Transfer ("ArrayListItem sDisplayed.aspx ");
}

private void Page_Load(objec t sender, System.EventArg s e)
{
WebForm1 debtor_enquiry = base.Context.Ha ndler 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*****@discus sions.microsoft .com> wrote in message
news:63******** *************** ***********@mic rosoft.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.EventArg s e)
{
Server.Transfer ("ArrayListItem sDisplayed.aspx ");
}

private void Page_Load(objec t sender, System.EventArg s e)
{
WebForm1 debtor_enquiry = base.Context.Ha ndler 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*****@discus sions.microsoft .com> wrote in message
news:45******** *************** ***********@mic rosoft.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*****@discus sions.microsoft .com> wrote in message
news:63******** *************** ***********@mic rosoft.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.EventArg s e)
> {
> Server.Transfer ("ArrayListItem sDisplayed.aspx ");
> }
>
> private void Page_Load(objec t sender, System.EventArg s e)
> {
> WebForm1 debtor_enquiry = base.Context.Ha ndler 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
3907
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 think my logic seems fine but when I click the button on my datagrid nothing seems to happen. Have you any idea where Im going wrong. Was thinking it might have something to do with my page load/ postback but not really sure. Can someone please...
10
3594
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: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemcollectionsicollectionclasssyncroottopic.asp) And I'm interested in locking an ArrayList during the entire enumeration, as shown in the example code. My problem is that I'm STILL...
3
2859
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 datagrid. I am using the viewstate object to store the Arraylist items on the page on postback. My PROBLEM is that I need to redirect the user to a new aspx page and on this new page i need to be able to access the items in my arraylist. Is this...
2
5877
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 items in an array list. My problem is that I also have had to incorporate some Javascript to see whether the user is ok with moving forward. Everything is fine and works apart from when the user clicks cancel on the pop-up Internet Explorer window it...
5
2140
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 pages ArrayList. Seems pretty simple so far. However, when I clear the items ArrayList it clears everything. What I am trying to do is add a page worth of items to the pages ArrayList, clear it and then create another page worth of items etc...
7
1797
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
1981
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, which could be why no-one answered it!! I've now narrowed the problem down, so am starting a new, more specific, thread. Sorry it's a bit long, but it's reasonably simple stuff. I have a page where I'm showing product details, including any
5
1215
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, New ListItem("No Preference", 999999)) ddLetMaxPrice.Items.Insert(1, New ListItem("100", 100)) ddLetMaxPrice.Items.Insert(2, New ListItem("200", 200)) ddLetMaxPrice.Items.Insert(3, New ListItem("300", 300)) ddLetMaxPrice.Items.Insert(4, New...
3
224
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 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...
0
9639
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9474
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10308
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10076
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8964
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6729
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4040
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 we have to send another system
2
3633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2870
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.