p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

csharptoday_discuss thread: Dynamic Web Pages


Message #1 by "Bill Swartz" <wmswartz@s...> on Mon, 24 Dec 2001 09:13:59
I'm having a little difficulty getting started with dynamic web page 

creation.



I would like to build an application that has very dynamic web pages 

based upon meta data in a database.   The labels, textboxes, and selects  

can vary dramatically.



I have seen examples of using the InnerHtml Method to post changes to 

HTML, however, I have been unable to get Div, or Span to work.



I have tried something like this, but the Div Tag is not accessible.

HTML

<div id="divUserSection" runat="server" />



C#

StringBuilder htmlForm = new StringBuilder();



htmlForm.Append("<Table><TR><TD><asp:Label id=\"lblUserName\" 

runat=\"server\" Width=\"131\" Height=\"19

\">UserName:</asp:Label></TD><TD style=\"HEIGHT: 20px\"></TD><TD 

style=\"HEIGHT: 20px\"><asp:TextBox id=\"txtUserName\" runat=\"server\" 

Width=\"308px\" Height=\"22px\"></asp:TextBox></TD></TR></Table>");



divUserSection.InnerHtml = htmlForm.ToString();



Upon Compile, the identifier divUserSection returns the error type or 

namespace not found.



I do know that if I put the code into the ASP file itself versus a 

codebehind page it will compile and execute successfully.   



So, If I want to create classes that dynamically generate Web Pages, how 

can I do this??



Not to confuse this issue, but eventually I will move to having the 

DataSet generate XML, and have the page generated with ASP/XML/XSLT 

combination.



Thanks in advance for you help.

Bill

  Return to Index