Results 1 to 14 of 14

Thread: how to use System.Web [02/03] !?!?!?

Threaded View

  1. #1

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    Question how to use System.Web [02/03] !?!?!?

    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.

    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 -->");
             }
        }
    }
    Okay, that is the way I understand you make a html element in a .net framework environment.

    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.

    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;
    
    //namespaces are bad ?!?!?!?!
    public class HtmlControl
    {
         public string GetHtml()
         {
               StringBuilder ret = new StringBuilder();
               //generate string with StringBuilder
              return ret.ToString();
         }
    }
    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 whatever

    Do you think this would work..?

    You make new files the implement the old stuff. Then as we move on we start to:

    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());
             }
        }
    }
    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:
    //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"));
    Please any input, remarks, request for more explination of what I talking about... lay it on me man.
    Last edited by Magiaus; Mar 17th, 2007 at 11:24 AM. Reason: bad title
    Magiaus

    If I helped give me some points.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width