I've been wrestling with C#/.net web content for the last while, bought crateloads of books and read gig's of websites... So many ways of dealing with page navigation to DB connections to CSS to everything else. So I thought about starting a Best Practices thread -- what people believe are the standard ways to setup common page designs/templates (that are not the built in ones that ship with 2003).
Methods/Functions/Script Blocks etc
- I've seen one large Pageload hold a whole site and its navigation/DB calls. This makes sense for smaller sites but as the size of a site and complexity grows creating namespaces seems more appropriate.. or is it really?
- Refraining from creating HTML content inside your C# code (IE HTMLstring += "<TABLE><TR><TD>Hello</TD></TR></TABLE>"; ). If this is bad form how do you handle dynamic controls or CSS formatted items like Lists (<UL><LI>). There is no <:ASP code that mimics html lists and so many CSS sites make use of HTML lists for interface components. So if you want to have a List with a bunch of Href's how do you handle that in C#/.net and retain the benefits of serverside code?
- When or When Not to use a dataset? Just for interface components (like drop downs etc)
- Passing values between the same page? URL variables are frowned upon and creating parameters and server transfers ( Server.Transfer("Webform2.aspx")) etc..
I find myself sliding into the abyss of.. I can generate code faster if I just dump out a string to a <:ASP label to create dynamic content. I know this poor form -- but its getting tough to see what good form is.
Any thoughts?
Wolfgang
Methods/Functions/Script Blocks etc
- I've seen one large Pageload hold a whole site and its navigation/DB calls. This makes sense for smaller sites but as the size of a site and complexity grows creating namespaces seems more appropriate.. or is it really?
- Refraining from creating HTML content inside your C# code (IE HTMLstring += "<TABLE><TR><TD>Hello</TD></TR></TABLE>"; ). If this is bad form how do you handle dynamic controls or CSS formatted items like Lists (<UL><LI>). There is no <:ASP code that mimics html lists and so many CSS sites make use of HTML lists for interface components. So if you want to have a List with a bunch of Href's how do you handle that in C#/.net and retain the benefits of serverside code?
- When or When Not to use a dataset? Just for interface components (like drop downs etc)
- Passing values between the same page? URL variables are frowned upon and creating parameters and server transfers ( Server.Transfer("Webform2.aspx")) etc..
I find myself sliding into the abyss of.. I can generate code faster if I just dump out a string to a <:ASP label to create dynamic content. I know this poor form -- but its getting tough to see what good form is.
Any thoughts?
Wolfgang