Best way to render a custom web control

Discussion in 'ASP .Net Web Controls' started by DalePres, Jun 26, 2004.

  1. DalePres

    DalePres Guest

    I have a custom web control that basically consists of a dynamically created
    table and HTML checkboxes. I spent hours typing things like:

    writer.AddAttribute(HtmlTextWriterAttribute.SomeAttribute, "SomeValue");
    writer.RenderBeginTag(Td);
    writer.Write("Some stuff");
    writer.RenderEndTag();

    My question is, is there a reason for typing all that? Is there an
    advantage to creating the control that way over just using:

    writer.Write("<TD SomeAttribute="SomeValue">Some stuff</TD>");

    Thanks,

    Dale
     
    DalePres, Jun 26, 2004
    #1
    1. Advertising

  2. DalePres

    Scott G. Guest

    A possible advantage of rendering literal HTML using the HtmlTextWriterAttribute is that someday when MS upgrades the framework you might have a better chance conforming to newer web standards -- i.e. UPPER case tags are illegal in XHTML etc.

    Scott
    "DalePres" <> wrote in message news:%...
    I have a custom web control that basically consists of a dynamically created
    table and HTML checkboxes. I spent hours typing things like:

    writer.AddAttribute(HtmlTextWriterAttribute.SomeAttribute, "SomeValue");
    writer.RenderBeginTag(Td);
    writer.Write("Some stuff");
    writer.RenderEndTag();

    My question is, is there a reason for typing all that? Is there an
    advantage to creating the control that way over just using:

    writer.Write("<TD SomeAttribute="SomeValue">Some stuff</TD>");

    Thanks,

    Dale
     
    Scott G., Jun 26, 2004
    #2
    1. Advertising

  3. DalePres

    DalePres Guest

    That's a thought, but it's a big investment in time and effort for what may
    come in the future.

    I wonder if this is another case of Microsoft teaching us all how to use the
    functionality just because it's there... Sort of like climbing Mount
    Everest... Or, should I say Mount St. Helens... Or using Web Server Controls
    when a simple HTML control will work...

    Dale

    "Scott G." <> wrote in message
    news:...
    A possible advantage of rendering literal HTML using the
    HtmlTextWriterAttribute is that someday when MS upgrades the framework you
    might have a better chance conforming to newer web standards -- i.e. UPPER
    case tags are illegal in XHTML etc.

    Scott
    "DalePres" <> wrote in message
    news:%...
    I have a custom web control that basically consists of a dynamically created
    table and HTML checkboxes. I spent hours typing things like:

    writer.AddAttribute(HtmlTextWriterAttribute.SomeAttribute, "SomeValue");
    writer.RenderBeginTag(Td);
    writer.Write("Some stuff");
    writer.RenderEndTag();

    My question is, is there a reason for typing all that? Is there an
    advantage to creating the control that way over just using:

    writer.Write("<TD SomeAttribute="SomeValue">Some stuff</TD>");

    Thanks,

    Dale
     
    DalePres, Jun 26, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    731
  2. Lau Lei Cheong

    Page.Render do not render complete page

    Lau Lei Cheong, May 15, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,092
    Lau Lei Cheong
    May 15, 2004
  3. TS
    Replies:
    5
    Views:
    407
    Steven Cheng[MSFT]
    Jul 6, 2007
  4. Replies:
    1
    Views:
    394
    Teemu Keiski
    Jul 2, 2003
  5. Glenn Gillen
    Replies:
    0
    Views:
    288
    Glenn Gillen
    Nov 17, 2006
Loading...

Share This Page