Dynamic generate web content

yfng

Member
Joined
Feb 23, 2005
Messages
13
Programming Experience
Beginner
I want to generate a web page such that its content is dynamically generated and the content can be duplicated inside (i.e. many similar tables). Is there any method other than response.write() the web content since the tables I prepared is rather long and complicated?
 

TPM

Well-known member
Joined
Dec 7, 2004
Messages
623
Location
CA
Programming Experience
3-5
You could use response.write but if it's an asp:table it would probably be easier to copy it and use controls.add("Copiedtable")
 

yfng

Member
Joined
Feb 23, 2005
Messages
13
Programming Experience
Beginner
TPM said:
You could use response.write but if it's an asp:table it would probably be easier to copy it and use controls.add("Copiedtable")

Thanks.
Btw, I don't know asp.net much, do you mean I should create UserControl(.ascx) which contains asp:table and then in the page of dynamic content, add the tables one by one?
 

TPM

Well-known member
Joined
Dec 7, 2004
Messages
623
Location
CA
Programming Experience
3-5
You could make a usecontrol but it's probably easier to dim a new table and use me.controls.add(newtable).
 

yfng

Member
Joined
Feb 23, 2005
Messages
13
Programming Experience
Beginner
Thanks TPM.
However.. I still do not understand how to achieve this.
The creation of tables should be in page_load or where?
How to insert some controls of buttons?

Would you mind to post some simple codes here?

Thanks again.
 

RTT

Active member
Joined
Mar 16, 2005
Messages
26
Programming Experience
Beginner
if you are willing it would be helpfull for me and maybe others to post some code of your solution... share the knowledge :p

thxs
 

yfng

Member
Joined
Feb 23, 2005
Messages
13
Programming Experience
Beginner
maybe it's too simple so no one reply my question~:p
I do it as follows:
Drag and drop a Placeholder to the web form.

For html codes:
placeholder.controls.add(new literalControl("<p>message</p>"))

For insert table:
Dim nTable As Table = New Table
'inserting tablerow and tablecell
.
.
.
placeholder.controls.add(nTable)

You may also create <div> by adding a Panel
 
Top Bottom