tags:

views:

46

answers:

4

hi all is there any asp.net server control that is not rendering in html page ? for instance <asp: TextBox runat ="server" id="Textbox1"><asp:/TextBox> is rendered as <input type="Text" id="textbox1"/>? i think you would understand my question ?

A: 

Every class deriving from the base class WebControl are meant to be rendered. That base class contains essentially rendering stuff such as styles and of course, the Render method.

Of course you can override the Render method and void it, but I don't see the advantage of having a UI control that doesn't render anything.

Both Literal & PlaceHolder have been designed to render stuff, but by default, they render nothing.

Use a plain class instead.

Pierre 303
A: 

It's a bit of a guess at what you're after, but maybe <asp:HiddenField /> ?

Jonny Cundall
An hidden field is rendered as HTML, but not visible in the browser window. Maybe it's what he is looking for ?
Pierre 303
+2  A: 

The Literal control is not rendered unless something is added to the Text property, in which case just the contents of the Text property are rendered. Likewise, the Placeholder control only renders the controls placed in its Controls collection.

<asp:Literal ID="literal1" runat="server" />

<asp:PlaceHolder ID="placeholder1" runat="server" />
Daniel Dyson
They are both used to render things. I think he is asking for server controls that are not meant to render anything ?
Pierre 303
Who knows what they are asking. That was my interpretation.
Daniel Dyson
A: 

The <asp:placeholder> control.

The <asp:panel> produces a div but the has no output but its great for adding controls without adding unwanted additional html

Solyad