Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 24th, 2005, 02:00 AM
Registered User
 
Join Date: Aug 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to joshwines
Default Filling a table from an array using a Loop

As the subject says, having a bit of trouble though.

<asp:tablerow id="message1" runat="server">
  <asp:tablecell id="m0" runat="server"></asp:tablecell>
  <asp:tablecell id="m1" runat="server"></asp:tablecell>
  <asp:tablecell id="m2" runat="server"></asp:tablecell>
  <asp:tablecell id="m3" runat="server"></asp:tablecell>
  <asp:tablecell id="m4" runat="server"></asp:tablecell>
  <asp:tablecell id="m5" runat="server"></asp:tablecell>
</asp:tablerow>

I want to fill a table like this from an array i have created from a split String. Cfor my counter below the eg. (obviously not the exact same) but i don't know how to go about filling the table easily

'eg.("m" + counter).Text = strArray(counter) --> obviously doesnt work but the idea is there

For counter = 0 to intArrayLength
m0.Text = strArray(counter)
Next counter

Thanks for any help in advance..

 
Old August 25th, 2005, 10:45 PM
Registered User
 
Join Date: Aug 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

Here is a code to display all elements in the array:

<script runat="server">

Sub Page_Load()
  Dim strArray() As String = {"Apple", "Orange", "Grape"}

  Response.Write("<TABLE border=1>")

  For Each fruit As String In strArray
    Response.Write("<TR><TD>" + fruit + "</TD></TR>")
  Next

  Response.Write("</TABLE>")
End Sub

</script>

Hope this would help.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Array and Loop ublend Classic ASP Professional 2 November 21st, 2007 07:50 AM
loop array problem dbrine Java Basics 2 June 15th, 2007 06:49 AM
Problem with loop and array katlees MySQL 1 July 5th, 2006 11:24 PM
create array for loop in FSO jfergy Classic ASP Professional 4 April 14th, 2006 09:59 PM
filling a combo box using an array tware VB Databases Basics 0 September 21st, 2004 08:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.