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

Designing Table Programmatically

I need to create some tables on a web page at run time rather than design
time. There could be 1 - 5 tables on the page depending on options. I've
created the tables by creating the cells, rows, and tables just as I want
them, but I don't know how to get them to render. Is there a function to add
the html code for the tables to the aspx file during run time? What is the
best way to handle this. Any examples I find to creating tables
programmatically has the programmer manually add the html code to the aspx
file during design time rather than creating them dynamically for a different
number of controls.
Nov 19 '05 #1
6 1654
You just create HtmlTable Controls and add them to the Controls Collection
of the WebForm.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
The sun never sets on
the Kingdom of Heaven

"David Tilman" <Da*********@discussions.microsoft.com> wrote in message
news:D7**********************************@microsof t.com...
I need to create some tables on a web page at run time rather than design
time. There could be 1 - 5 tables on the page depending on options. I've
created the tables by creating the cells, rows, and tables just as I want
them, but I don't know how to get them to render. Is there a function to
add
the html code for the tables to the aspx file during run time? What is the
best way to handle this. Any examples I find to creating tables
programmatically has the programmer manually add the html code to the aspx
file during design time rather than creating them dynamically for a
different
number of controls.

Nov 19 '05 #2
You add them to the Controls property for some parent element. When you say
that you created the cells and rows, do you mean actual TableCell and
TableRow objects?

1) Add some container to your HTML like a DIV. Something that you can
reference in code.
2) Mark this as "runat=server".
3) Add the Table object to the Controls property for the DIV. The table
should then render.
"David Tilman" <Da*********@discussions.microsoft.com> wrote in message
news:D7**********************************@microsof t.com...
I need to create some tables on a web page at run time rather than design
time. There could be 1 - 5 tables on the page depending on options. I've
created the tables by creating the cells, rows, and tables just as I want
them, but I don't know how to get them to render. Is there a function to add the html code for the tables to the aspx file during run time? What is the
best way to handle this. Any examples I find to creating tables
programmatically has the programmer manually add the html code to the aspx
file during design time rather than creating them dynamically for a different number of controls.

Nov 19 '05 #3
Use HTMLtextwriter to render and write this in the render event.
Or
Drop placeholder object in the aspx page ...and add controls to it whatever
u have created dynamically
Or
Add controls to Form itself but here u can place it exactly in the way u
need it.

"Kevin Spencer" wrote:
You just create HtmlTable Controls and add them to the Controls Collection
of the WebForm.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
The sun never sets on
the Kingdom of Heaven

"David Tilman" <Da*********@discussions.microsoft.com> wrote in message
news:D7**********************************@microsof t.com...
I need to create some tables on a web page at run time rather than design
time. There could be 1 - 5 tables on the page depending on options. I've
created the tables by creating the cells, rows, and tables just as I want
them, but I don't know how to get them to render. Is there a function to
add
the html code for the tables to the aspx file during run time? What is the
best way to handle this. Any examples I find to creating tables
programmatically has the programmer manually add the html code to the aspx
file during design time rather than creating them dynamically for a
different
number of controls.


Nov 19 '05 #4
You add them to the Controls property for some parent element. When you say
that you created the cells and rows, do you mean actual TableCell and
TableRow objects?

1) Add some container to your HTML like a DIV. Something that you can
reference in code.
2) Mark this as "runat=server".
3) Add the Table object to the Controls property for the DIV. The table
should then render.
"David Tilman" <Da*********@discussions.microsoft.com> wrote in message
news:D7**********************************@microsof t.com...
I need to create some tables on a web page at run time rather than design
time. There could be 1 - 5 tables on the page depending on options. I've
created the tables by creating the cells, rows, and tables just as I want
them, but I don't know how to get them to render. Is there a function to add the html code for the tables to the aspx file during run time? What is the
best way to handle this. Any examples I find to creating tables
programmatically has the programmer manually add the html code to the aspx
file during design time rather than creating them dynamically for a different number of controls.

Nov 19 '05 #5
Use HTMLtextwriter to render and write this in the render event.
Or
Drop placeholder object in the aspx page ...and add controls to it whatever
u have created dynamically
Or
Add controls to Form itself but here u can place it exactly in the way u
need it.

"Kevin Spencer" wrote:
You just create HtmlTable Controls and add them to the Controls Collection
of the WebForm.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
The sun never sets on
the Kingdom of Heaven

"David Tilman" <Da*********@discussions.microsoft.com> wrote in message
news:D7**********************************@microsof t.com...
I need to create some tables on a web page at run time rather than design
time. There could be 1 - 5 tables on the page depending on options. I've
created the tables by creating the cells, rows, and tables just as I want
them, but I don't know how to get them to render. Is there a function to
add
the html code for the tables to the aspx file during run time? What is the
best way to handle this. Any examples I find to creating tables
programmatically has the programmer manually add the html code to the aspx
file during design time rather than creating them dynamically for a
different
number of controls.


Nov 19 '05 #6
You can send HTML markup to browser using
Response.Write("HTMLstringthatbuildstables")

Charlie
"David Tilman" <Da*********@discussions.microsoft.com> wrote in message
news:D7**********************************@microsof t.com...
I need to create some tables on a web page at run time rather than design
time. There could be 1 - 5 tables on the page depending on options. I've
created the tables by creating the cells, rows, and tables just as I want
them, but I don't know how to get them to render. Is there a function to
add
the html code for the tables to the aspx file during run time? What is the
best way to handle this. Any examples I find to creating tables
programmatically has the programmer manually add the html code to the aspx
file during design time rather than creating them dynamically for a
different
number of controls.

Nov 19 '05 #7

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

Similar topics

5
by: Millie Niss | last post by:
I am new to PHP and mySQL, and I am trying to build a database of services (on a service table) provided by agencies (another table), where one agency can provide many services, but a service...
0
by: Lefevre, Steven | last post by:
I'm working on a website/database deal, and right now I'm designing the security model. It's using LAMP(HP), so all the tricks are going to be through PHP. First off, this will be behind a...
2
by: Jozef | last post by:
Hello, Is there a way to change table permissions in VB Code? I can't seem to find much that's concise in the help file. Here's the situation; I have a table in the "data" portion of a split...
3
by: Marty McDonald | last post by:
I have <asp:Table... </asp:Table> on my webform. In codebehind, I populate a DataTable whose data should appear in the asp:Table. I created my own code to populate the asp:Table with the...
1
by: David Tilman | last post by:
I need to create some tables on a web page at run time rather than design time. There could be 1 - 5 tables on the page depending on options. I've created the tables by creating the cells, rows,...
1
by: puttypapyrus | last post by:
I am having trouble designing the tables and establishing relationships for a survey database for the purpose of evaluating speakers for a variety of events. After every event, the attendants are...
2
by: OceanBreeze | last post by:
Border drawn in C# Table programmatically even if several adjacent horizontal & vertical cells are empty in the table I want to programmatically have border on each and every row and column in the...
0
by: | last post by:
I am wondering the best and easiest ways to use the VS.NETvisual designer with data controls that will will be loaded programmatically. For example, I have two datalist controls, one of which I'm...
6
by: kakas | last post by:
Hi there, I am a newbie to web development and db programming. I have recently started reading about ASP.net and SQL. To gain some practical experience i am trying to do the following : 1) ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.