As of now I have a .aspx page with a page_load routine that uses response.write to output all of my html... Is there maybe a better way to do this so I don't have my code and my html tangled together. I have been looking at the server table control but I can't see how I would be able to format it correctly. Because of the size of the file that is created I want to use CSS or something similar instead of outputting the styles of each cell because the file just becomes huge. Right now I have about 6 to 8 TD classes and 3 to 5 FONT classes. If it will help I'll show you some code below. Any opinions would be helpful.
Cheers,
If Itemlist.Item("revision") Then
Response.Write("<tr><td class='revision'></td>")
Else
Response.Write("<tr><td class='norevision'></td>")
End If
If Itemlist.Item("deleted") Then
Response.Write("<td class='content'></td><td class='content'><font class='content'>DELETED</font></td><td class='content'></td><td class='content'></td><td class='content'></td></tr>")
RowCount = RowCount + 1
Else If (itemlist.Item("attachingpart") AND (AttachingPart = False)) Then
AttachingPart = True
Response.Write("<td class='content'></td><td class='content'></td><td class='content'><font class='content'>****ATTACHING PARTS****</font></td><td class='content'></td><td class='content'></td></tr>")
RowCount = RowCount + 1
Else If (Not(itemlist.Item("attachingpart")) AND (AttachingPart = True)) Then
AttachingPart = False
Response.Write("<td class='content'></td><td class='content'></td><td class='content'><font class='content'>----*----</font></td><td class='content'></td><td class='content'></td></tr>")
RowCount = RowCount + 1
Else
Hey, thats pretty funny... I have B tags in my code and even though they are rapped in the CODE tags it displays the code bold... I figured it would just leave them. I guess I have to use the & things. Anyway, my entire page looks like this right now and is very similar to regular asp. Any ideas?I think I may have wanted to ask a different question. How can I create a new table during run time. Say I want my html body to start off empty and then add tables as I go. Can I do that?
Yes, of course. Try to avoid Response.Write.
You can create a new Table object from your code, and add it to Page.Controls.
This way, you can construct any page structure you want.
Does this help?
Yep, thanks. It gets hard when there are many ways to do the same thing.
Cheers,
0 comments:
Post a Comment