473,799 Members | 3,416 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4133
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*********@ho tmail.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*********@ho tmail.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:0d2901c36b d6$20166da0
$a*******@phx.g bl:
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.Ad d(tblCell)
tblTest.Rows.ad d(tblRow)
Next
--
Lucas Tam (RE********@rog ers.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
15607
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
1597
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 look/feel of the tables. Is this possible?
3
2892
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 user selects a file, then clicks Import Data. The page now reads the PostedFile and displays each line as a new row in the newTransactions table. All of this works fine. For now, I've programmed SaveTrans_Click to display the number of rows in the...
5
1302
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, all my dynamic building is gone. the page reverts back to it's "original" design time state. i have a OK button, that when the user clicks on this button, it will go and get data from the dynamically built page. but obviously i cant do that,
2
2914
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 avoid the problem by avoiding the table control or resorting to databound controls that better manage state for me. I hope to understand how to solve the problem by using the Table web control and sticking to the approach of building the table at run...
7
10068
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 main menu instead of showing all possible options and only enabling/disabling certain ones. I have a table that stores the menu item name, parent item (if applicable), display order, etc. so that I can dynamically load my
8
2822
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. How can I get the height of the control (in code) after it grows? I am building a windows form dynamically, creating controls and placing them on the form. There can be dozens of controls of all types on the form. This is for dynamic...
2
6540
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 trying to create a db for a friend's business. I have two issues that I'm wrestling with. First is how to dynamically create a text box on a form. I'm building a form that relates information between two tables (A, B). Table B is the source of...
0
9544
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
10490
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
10238
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
10030
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7570
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6809
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();...
0
5589
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4145
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
3761
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.