473,403 Members | 2,284 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,403 software developers and data experts.

Dynamically Building a Table

Hello, I have spen hours trying to find information on
dynamically building a table from an array.

What I need:
I have an array pulling file paths from a directory using
a For Next Loop. F is the file. For every instance of F
I would like the file path put into the table. The table
is just a single column table.

I have looked at the Table class on msdn and that hasn't
helped me much. Can someone show me an example or maybe
lead me somewhere besides msdn for information.

Thanks
Nov 17 '05 #1
4 4118
Hi

Try this way:

Response.Write("<TABLE>")
Response.Write("<TR>")
foreach(file in files)
{
Response.Write("<TD>")
Response.Write(file)
Response.Write("</TD>")

}
Response.Write("</TR>")
Response.Write("</TABLE>")

HTH

Ravikanth[MVP]

-----Original Message-----
Hello, I have spen hours trying to find information on
dynamically building a table from an array.

What I need:
I have an array pulling file paths from a directory usinga For Next Loop. F is the file. For every instance of FI would like the file path put into the table. The tableis just a single column table.

I have looked at the Table class on msdn and that hasn't
helped me much. Can someone show me an example or maybe
lead me somewhere besides msdn for information.

Thanks
.

Nov 17 '05 #2
That is certainly one way.

Alternatively, if you want to use a table control, then you'd need to:

declare (or add) a table control
then create table rows
for each table row, you'd need to create, and add, a table cell
for each table cell, you'd need to add a literal control containing the text
that you want.

Cheers
Ken

"Ravikanth[MVP]" <dv*********@hotmail.com> wrote in message
news:0d****************************@phx.gbl...
: Hi
:
: Try this way:
:
: Response.Write("<TABLE>")
: Response.Write("<TR>")
: foreach(file in files)
: {
: Response.Write("<TD>")
: Response.Write(file)
: Response.Write("</TD>")
:
: }
: Response.Write("</TR>")
: Response.Write("</TABLE>")
:
: HTH
:
: Ravikanth[MVP]
:
:
: >-----Original Message-----
: >Hello, I have spen hours trying to find information on
: >dynamically building a table from an array.
: >
: >What I need:
: >I have an array pulling file paths from a directory
: using
: >a For Next Loop. F is the file. For every instance of
: F
: >I would like the file path put into the table. The
: table
: >is just a single column table.
: >
: >I have looked at the Table class on msdn and that hasn't
: >helped me much. Can someone show me an example or maybe
: >lead me somewhere besides msdn for information.
: >
: >Thanks
: >.
: >
Nov 17 '05 #3
> Try this way:

Response.Write("<TABLE>")
Response.Write("<TR>")
foreach(file in files)
1. Using Response.Write in an ASPX page is not object-oriented.
2. This example seems to be using a combination of VB.Net and C# - it would
never work as it stands

Brian didn't specify what kind of table he wanted to use (HtmlTable or Table
Web Server Control). I will use the one with the smallest footprint
(HtmlTable) for this explanation. The principle would be the same for a
Table Web Server Control.

The easiest thing to do would be to put an HtmlTable Control on the page.
Then you can add rows and cells to it. A row is an HtmlTableRow object, and
it is added to the table's Rows Collection. Once you add a row, you can add
cells. The HtmlTableRow class has a Collection of HtmlTableCell objects. So,
assuming that you've put an HtmlTable control on your page, made it runat
server, and assigned an ID to it, all you need to do is loop through your
array, and

1. Add an HtmlTableRow to the Rows collection of the table
2. Add an HtmlTableCell to the Cells collection of the row
3. Assign the value from the array to the InnerHtml or InnerText property of
the cell

- for each element in the array.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
The more I learn, the less I know.

"Ravikanth[MVP]" <dv*********@hotmail.com> wrote in message
news:0d****************************@phx.gbl... Hi

Try this way:

Response.Write("<TABLE>")
Response.Write("<TR>")
foreach(file in files)
{
Response.Write("<TD>")
Response.Write(file)
Response.Write("</TD>")

}
Response.Write("</TR>")
Response.Write("</TABLE>")

HTH

Ravikanth[MVP]

-----Original Message-----
Hello, I have spen hours trying to find information on
dynamically building a table from an array.

What I need:
I have an array pulling file paths from a directory

using
a For Next Loop. F is the file. For every instance of

F
I would like the file path put into the table. The

table
is just a single column table.

I have looked at the Table class on msdn and that hasn't
helped me much. Can someone show me an example or maybe
lead me somewhere besides msdn for information.

Thanks
.

Nov 17 '05 #4
"brian" <br****@lbrspec.com> wrote in news:0d2901c36bd6$20166da0
$a*******@phx.gbl:
Hello, I have spen hours trying to find information on
dynamically building a table from an array.

What I need:
I have an array pulling file paths from a directory using
a For Next Loop. F is the file. For every instance of F
I would like the file path put into the table. The table
is just a single column table.

I have looked at the Table class on msdn and that hasn't
helped me much. Can someone show me an example or maybe
lead me somewhere besides msdn for information.

Dim tblRow as TableRow
Dim tblCell as TableCel
Dim tblTest as Table = New Table()

For i = 0 to somebound
tblRow = New TableRow()
tblCell = new TableCell()

tblCell.text = "Some Junk Here"
tblRow.Cells.Add(tblCell)
tblTest.Rows.add(tblRow)
Next
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 17 '05 #5

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

Similar topics

5
by: Billy Cormic | last post by:
Hello, I am interested in dynamically creating temp tables using a variable in MS SQL Server 2000. For example: DECLARE @l_personsUID int select @l_personsUID = 9842
3
by: Craig | last post by:
Quick question. I have HTML tables that get created on the fly. The size of rows/columns depends on the report the user is looking at. What I want to do is take more control over the...
3
by: Bijoy Naick | last post by:
I have something strange going on.. My .aspx page contains a file upload control, a "Import Data" button, a "newTransactions" <asp:table>, a"SaveTrans" button and an confMsg label. First the...
5
by: Jason | last post by:
Hi all I am building a page dynamically on Page_Load. using Table web controls for this. the web page builds up and loads up and displays ok. but as soon as there is a post back of any sort,...
2
by: Chad | last post by:
I have a problem that I am desperate to understand. It involves dynamically adding controls to a Table control that is built as a result of performing a database query. I am not looking to...
7
by: Steve_Black | last post by:
Hello, I'm toying with the idea of loading a MenuStrip (VB.Net 2005) dynamically based on who is logged into my system. Every user has different security settings and I want to customize the...
8
by: BillE | last post by:
When I create a control dynamically and it grows according to the content, the control Height property still returns the original default control height instead of the height after expanding. ...
2
by: ssmith147 | last post by:
Hi, I'm somewhat familiar with access and vb programming (I can read someone else's code, for the most part), but I'm still very green when it comes to creating solutions for my own needs. I'm...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
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...

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.