471,122 Members | 1,147 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,122 software developers and data experts.

HTML Code generation

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.
Jun 7 '06 #1
4 1342
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.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Ganesh Muthuvelu" <Ga*************@discussions.microsoft.com> wrote in
message news:52**********************************@microsof t.com...
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.

Jun 7 '06 #2
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

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Ganesh Muthuvelu" wrote:
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.

Jun 7 '06 #3
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.

"Peter Bromberg [C# MVP]" wrote:
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

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Ganesh Muthuvelu" wrote:
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.

Jun 7 '06 #4
google "htmltextwriter"

"Ganesh Muthuvelu" <Ga*************@discussions.microsoft.com> wrote in message
news:52**********************************@microsof t.com...
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.

Jun 8 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

51 posts views Thread by Mudge | last post: by
13 posts views Thread by Michele Simionato | last post: by
3 posts views Thread by Christophe Guillon | last post: by
2 posts views Thread by Nick | last post: by
1 post views Thread by Gina | last post: by
1 post views Thread by Lonnie Princehouse | last post: by
1 post views Thread by Ryan Ginstrom | last post: by
15 posts views Thread by lxyone | last post: by

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.