Greetings
I have an interesting question to pose to you.
I'm going to say I have a set of ready to use and tuned html generation components: System.Web.UI, System.Web.UI.WebControls, System.Web.UI.HtmlControl. In these three namespaces we have the basics for generating every html element and any xhtml element(new System.Web.UI.HtmlControls.HtmlGeneric("myXHtmlTag")) that we want, and the rest of this namespace has an awareness of the items in these namespaces. Lets call this a fact.
I'm going to use C# because I think using a language in the same syntax as 2 out 4 (JavaScript, ActionScript, blank, Sql) other programming languages I use is a good thing.
Okay, that is the way I understand you make a html element in a .net framework environment.Code:using System; using System.Diagnostics; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; public namespace MyAssemblyName.Web.GUI //change is good { public sealed class WebWidget: System.Web.Control { //we need a place to render those string that is up to date protected overrides void Render(HtmlWriter w) { w.Write("<!-- widget html string -->"); } } }
So, lets say that it's just to slow..?!?!?!?!?!?!?!
What should I do? I know I'll write my own code that is not part of the .net framework and not compliant in anyway.. I'll use StringBuilder to render all html because it is fast. And, you know it is.
Let us say I have a lot of these files made in the "StringBuilder" format above. Well, let us also, say there is one file with a class for every html element known to man and some that we made cause they were cool. Tab views, menus you know whatever... html, dhtml, scripts... just all kinds of stuff done all over or hard typed into into .asp files or whateverCode:using System; using System.Diagnostics; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; //namespaces are bad ?!?!?!?! public class HtmlControl { public string GetHtml() { StringBuilder ret = new StringBuilder(); //generate string with StringBuilder return ret.ToString(); } }
Do you think this would work..?
You make new files the implement the old stuff. Then as we move on we start to:
For some of the more complex stuff this could get interesting as you have to introduce collections of these things and they have to maintain integrity across control depth... don't get me started on designers and vs.net eating my code or read write control designer my @$$....Code:using System; using System.Diagnostics; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; public namespace MyAssemblyName.Web.GUI //change is good { public sealed class WebWidget: System.Web.Control { //we need a place to render those string that is up to date protected overrides void Render(HtmlWriter w) { w.Write(new HtmlControl().GetHtml()); } } }
Please any input, remarks, request for more explination of what I talking about... lay it on me man.Code://what I mean by compliant Panel content = (Panel)thePageClass.Controls.FindControl("ContentPanel");//null my @$$ content.Controls.Clear(); content.Controls.Add(new CoolTabClass("ThatTabGroupName_Schema_Oo"));




Reply With Quote