HTML Code generation

G

Guest

Hello,
I was wondering if there is a way to store all the HTML element information
in a database and then dynamically generate the HTML code for a page?..
Basically, I do not want to design every HTML page, instead just define the
elements like "label", "Textbox", "Submit" button etc., in a database and
then have a tool generate the HTML code forme..
Does anyone have any ideas or pointers??

Thanks.
 
N

Nathan Sokalski

That would be tough because the elements are objects, and do not all have
the same properties (a TextBox does not have the same properties as a Label,
for example). If you REALLY wanted to do that (I don't know why you would,
if you know exactly what the HTML will be use a *.html file), create a
database table with 3 fields:

First Field (the primary key): an integer specifying the order of the tags
Second Field: a string that lists the tag (such as input, font, table, etc.)
and attributes or literal content
Third Field: a string that specifies whether the second field is an opening
tag, closing tag, or literal content

The second field would need to be parsed, since it must be all one string
and you cannot have separate fields for the properties since different tags
have different properties. When the third field has a value of 'closingtag'
you can either give the second field an empty string and dynamically
determine what tag it is closing or just give the second field a value of
what the closing tag would look like (</table>, </font>, etc.). However, I
still think that doing this is more work than necessary and that you should
find a better way, if you let us know your reason for wanting to put this
info in a database instead of one of the conventional methods we might be
able to help you find a better and easier way to achieve your goal.
 
G

Guest

Ganesh,
Certainly you *could* do that; essentially you are describing a means of
assembling a big string full of HTML. But, what would be the point of this?
It would be missing the server-side ASP.NET Page model, events, and
everything else needed for a fully functioning ASP.NET application.
Sounds like a step backwards to me.
Now, if you want to add ASP.NET controls to a page programmatically, that
can certainly be done, and you can "have your cake, and eat it, too".
Peter
 
G

Guest

Peter,
Yes.. I see what you are saying. Now, is there a way to add ASP .NET
controls dynamically to a page including the layout of the controls as well
as the look & feel?..
Basically, I have a application which pulls data from a 3rd party system and
pushes data back to the same system after the user makes the changes.. All
data are exchanged as "XML".. So, I need to show the data in a neat way to
the user so that the user can change it and send it back..

Since the volume and type of data is so much, I cannot generate a ASPX page
for each XML exchange and hence looking for doing stuff dynamically if the
necessary info is stored in the database about the XML elements..

Any ideas/pointers will be appreciated..

Thanks.
 

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

Top