0

I know that in ASP.NET web forms developers can't control the output HTML. But does this happen with every thing in ASP.NET web forms? or is there secific controls that we can't control the HTML of them?

Cheers.

  • I really do not understand what you mean "control the output html". I use web forms and I control everything I need, the html is what I render... – Aristos Jul 06 '11 at 21:12
  • To get startet you could have a look at [this similar question's answer](http://stackoverflow.com/questions/461901/asp-net-control-to-html-tag-equivalent/462013#462013). But it might depend also on the browser the client is using(BrowserCaps). – Tim Schmelter Jul 06 '11 at 21:39

2 Answers2

2

The simplest rule of thumb is: the more the server control does for you, the more output markup there is going to be which you don't have control over.

The simplest is surely an asp:Literal - there's nothing in that beyond your control. An asp:Label is just a <span>. But once you work your way up to controls like asp:GridView, now you're talking some serious quantities of HTML and JavaScript being generated.

Carson63000
  • 4,215
  • 2
  • 24
  • 38
1

Any of the server controls will generate their own output. These would include anything that has the runat = "server" attribute. You have some control over the output, but it's declarative rather than imperative. Meaning you can tell the control what you'd like it to do, but not how to go about doing it.

Yuck
  • 49,664
  • 13
  • 105
  • 135