473,322 Members | 1,911 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,322 software developers and data experts.

How to print alternate arraylist values from two arraylist?

I have 2 arraylist which have equal number of elements. I need to print these values alternatively in an html table..for eg:

arraylist1 conatins: moviename1,moviename2,moviename3
arraylist2 contains: 8.00pm, 9.00pm, 10pm

Now, it has to be printed like this:

============================================
moviename1
============================================
8.00pm
============================================
moviename2
============================================
9.00pm
============================================
moviename3
============================================
10.00pm
============================================

I even have to add a <a> tag in the row which contains times. But first i have to print it alternatively..any help would be appreciated.
Feb 3 '11 #1
4 2809
code green
1,726 Expert 1GB
I would use
Expand|Select|Wrap|Line Numbers
  1. $combarr = array_combine($arraylist1,$arraylist2)
  2.  
Then
Expand|Select|Wrap|Line Numbers
  1. foreach($combarr as $movie=>$time)
  2. echo $movie.'<br>===<br>'.$time
Feb 3 '11 #2
thanx for your time and answer...however i figured out a simple way to do it...it didnt strike me earlier...

the code i wrote is:

for (int i = 0; i < arraylist1.Count; i++ )
{
<tr>
<td>
Response.Write(arraylist1[i]);
</td>
</tr>

<tr>
<td>
<a href="NextPage.aspx">
Response.Write(arraylist2[i]);</a>
</td>
</tr>
Feb 3 '11 #3
code green
1,726 Expert 1GB
Huge apologies.
I have submitted PHP code for a C# question.
Feb 3 '11 #4
It's ok...thanks for ur time anyways..
Feb 4 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: babu | last post by:
Hello All, How are you? I am facing an issue to print all the form control values (including datagrid values). Is there a way to print all the control values in VB.NET. If the grid...
6
by: rdi | last post by:
I have 3 classes: mailBox, mailFilter & mailFilterSet I then have an arraylist. Each element in the array is of type mailBox (variable name is mbox). One item of the mailbox class is an...
6
by: Iapain | last post by:
Hello, I've created an arraylist which consist arraylist ..like ArrayList myAL = new ArrayList(); // Main Array List ArrayList tmpAL = new ArrayList(); //Temp Array List tmpAL.Add(2); //Add...
11
by: Simon Says | last post by:
Hi all, I've an arraylist A1 that contains {0,1,2,3,4,5,9,8,7} I've another arraylist A2 that contains {4,5,9} I would like to search whether if A2 is present in A1 and maybe return the first...
6
by: Pavel Maly | last post by:
Hi, how do I access values in an ArrayList which is a part of another ArrayList? I know I can define a class and then it is quite simple, but this is just an auxiliary application to compute some...
10
by: Debajit Adhikary | last post by:
I'm writing this little Python program which will pull values from a database and generate some XHTML. I'm generating a <tablewhere I would like the alternate <tr>'s to be <tr class="Even">...
2
by: deepthisoft | last post by:
Hi, I have stored an Arraylist values into a javascript array.It is working fine. But i can't get the array values one by one. How can i do this, anyone can help me. This is very urgent for me. ...
1
by: saiindu | last post by:
Help me how to retrieve values which is stored in arraylist tokenizer and then make the values to print in jtable records.
0
by: ghjk | last post by:
I'm using jsp. I want to print string array values . How can I do that? please help me. This is my code. ArrayList settings = (ArrayList)session.getAttribute("settingList");
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.