Groups | Blog | Home
all groups > asp.net webcontrols > june 2004 >

asp.net webcontrols : Best way to render a custom web control


DalePres
6/25/2004 8:42:24 PM
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
6/26/2004 8:22:37 AM
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

[quoted text, click to view]
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
[quoted text, click to view]
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.
6/26/2004 9:01:30 AM
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
[quoted text, click to view]
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=3D"SomeValue">Some stuff</TD>");

Thanks,

AddThis Social Bookmark Button