Best way to render a custom web control

D

DalePres

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
 
S

Scott G.

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
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
 
D

DalePres

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

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
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top