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

Manually creating HTML... ASP.NET

Hi everyone, I have what is usually a familar problem but unsure about
how to solve it in ASP.NET.

I have an array of objects containing information, I would like to
create a table of these objects in my HTML page.

So in PHP, typically I would iterate through the objects generating the
html and storing it in a variable, finally i would output the variable
to the screen, wallah I have a dynamic table of data.

What is the process todo this in ASP.NET, it is difficult to convey
certain procedural steps in a fully OO environment.

Thanks for any help/advice.

Kind Regards
Taz

Feb 9 '06 #1
4 1161
Taz,

Put a literal control on your page where you want the table to appear.

Use a stringbuilder object to create your html table.

Then output the stringbuilder (Stringbuilder.ToString) as the text of the
literal.

Of course there are other ways to do this, but that's how to mimic what you
describe exactly.

An easier way however may be to hookup your objects directly to a GridView.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
<uk***********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Hi everyone, I have what is usually a familar problem but unsure about
how to solve it in ASP.NET.

I have an array of objects containing information, I would like to
create a table of these objects in my HTML page.

So in PHP, typically I would iterate through the objects generating the
html and storing it in a variable, finally i would output the variable
to the screen, wallah I have a dynamic table of data.

What is the process todo this in ASP.NET, it is difficult to convey
certain procedural steps in a fully OO environment.

Thanks for any help/advice.

Kind Regards
Taz

Feb 9 '06 #2
> Of course there are other ways to do this, but that's how to mimic what
you describe exactly.

An easier way however may be to hookup your objects directly to a
GridView.

--
Sincerely,


Hi many thanks for your reply!

I have discovered I can use something called a HttpTable control which i
will investigate. Your suggestion will definately come in useful!

However hooking up my objects to a GridView sounds interesting, i wasnt
aware this was possible, please could u provide a little more information?

With kind regards,
Taz
Feb 9 '06 #3
Use a Repeater, and bind it to the array. See:
http://msdn.microsoft.com/library/de...vercontrol.asp

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
We got a sick zebra a hat,
you ultimate tuna.
<uk***********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Hi everyone, I have what is usually a familar problem but unsure about
how to solve it in ASP.NET.

I have an array of objects containing information, I would like to
create a table of these objects in my HTML page.

So in PHP, typically I would iterate through the objects generating the
html and storing it in a variable, finally i would output the variable
to the screen, wallah I have a dynamic table of data.

What is the process todo this in ASP.NET, it is difficult to convey
certain procedural steps in a fully OO environment.

Thanks for any help/advice.

Kind Regards
Taz

Feb 9 '06 #4
Taz,

The new asp.net 2.0 GridView object can take a list of objects (use generics
to create the list) as it's datasource. This is done via a new
"ObjectDataSource" control.

There's a great article in the January 2006 Visual Studio Magazine on doing
so. It uses the new generics objects and is really slick. Pick up a copy if
you can.

And microsoft has another how-to here, but I don't think it's using generics
(I only took a brief glance though):

http://msdn2.microsoft.com/en-us/lib...atasource.aspx

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Tarun Mistry" <uk***********@gmail.com> wrote in message
news:u3**************@TK2MSFTNGP10.phx.gbl...
Of course there are other ways to do this, but that's how to mimic what
you describe exactly.

An easier way however may be to hookup your objects directly to a
GridView.

--
Sincerely,


Hi many thanks for your reply!

I have discovered I can use something called a HttpTable control which i
will investigate. Your suggestion will definately come in useful!

However hooking up my objects to a GridView sounds interesting, i wasnt
aware this was possible, please could u provide a little more information?

With kind regards,
Taz

Feb 9 '06 #5

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

Similar topics

3
by: none | last post by:
Hi. I'm implementing a web deployment using 9i. I have a table for STOCK, which has one or more PURCHASES, which have one or more PURCHASE_ITEMS. When a purchase item is INSERTED, I'd like the...
4
by: Francois Keyeux | last post by:
hello everyone: i have a web site built using vbasic active server scripting running on iis (it works on either iis 50 and 60, but is designed for iis 50) i know how to create a plain text...
0
by: Marc Callec | last post by:
I'm trying to create an instance of the CrystalReportViewer control within my class in an attempt to return the rendered HTML back to the consumer of the class. Because I haven't added the...
10
by: Jake Forson | last post by:
Hi there, I'd like to re-create a form given only its resource file. I was going to simply read the resource file and re-create the "Form" object and all its controls as found in this file...
6
by: Klemens | last post by:
I want to create an MQT, intialize it manually and then use staging table to refresh it with new data, but i don' t see a way for not doing full refresh after creating the staging table. I tried...
5
by: Gol Yass | last post by:
Hi I am using Visual Studio 2005 on windows XP professional (with IIS). Following the walkthrough provided by help "creating web page for mobile devices" , I have created a website , but as...
2
by: mj.redfox.mj | last post by:
Hi, Pretty basic question, apologies but being a bit of a newbie I still don't know the answer to this kind of thing! I have a repeater which, upon databind calls a subroutine, as below: ...
3
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
I design all of my pages in expression web. I then want to create a code behind file for the aspx page created by EW in VS 2005. How could I do this easily?
2
by: =?Utf-8?B?UiBSZXllcw==?= | last post by:
Hi, Is there a way to get/set (or override) SqlParameter.SourceColumn values manually? Code example: // create DeleteCommand by SourceColumn strSQL = "DELETE FROM WHERE (ID=@ID)"; using...
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: 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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
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
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...
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
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.