Dynamic Tables

C

Carlos Gomez

I used to develop with Classic ASP. Now I'm learning ASP.NET

I used to create tables 'on-the-fly' using recordsets. My code
would loop through the recorset.Fields to make the headers.
If I added a field to the table, I didn't have to update my code.
I liked the fact that I could test for a field.name to customize
a column title if I wanted to. Same goes for the rows, I often inserted
something in the cells of certain columns (textboxes, links, etc.)

Correct me if I'm wrong, but the only way I have found to achive this
is by using a Repeater. I would appreciate your opinions on any other
way to do this.

The problem with the repeater (to my best knowledge) is that you have
to know the fields of the table beforehand. The DataGrid doesn't cut it because I
still want to modify a title if it matches certain name and insert something
on the row cell if it is part of that column. Any way to dynamically create
a table regardless of the fields?

Thanks in advance.

-----------------------------
Note: I got this answer but the problem is that it seems like 'going backwards'
because I'd be using ASP.NET the same way as Classic ASP

"You can using place holder tag in where you'd like to place table, and
dynamic generate HTML content based-on recordsets, and assign that content
(string) to place holder's innerHTML property."
 
M

Marshal Antony

Carlos,
Using AutoGenerateColumns="true" can make your datagrid show all the
columns from a datasource without
specifying columns separately.
You can customize things in the Itemdatabound,ItemCreated etc.
events of the datagrid.
here is a link for datagrid events :

http://msdn.microsoft.com/library/d...ebcontrolsdatagridclassitemdataboundtopic.asp
You can create templates programmatically depends on your needs as well.
Here is another link for that..

http://msdn.microsoft.com/library/d...emplatesprogrammaticallyindatagridcontrol.asp

Hope this helps.
Regards,
Marshal Antony
http://www.dotnetmarshal.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top