Asp.NET C#.
It is possible to create HtmlGenericControl without tag ? If i write :
HtmlGenericControl o_My_Control = New HtmlGenericControl();
It automatically returns a span element. I need an UserControl because i must add this control into an another usercontrol Control.Add(o_My_Control) and i need to directly append html. I use o_My_Control.innerHTML.
Can you help me to find solution ?
A HtmlGenericControl is a control used to represent an HTML element and thus it has to have a name. You can either provide one or if you don’t it uses the default value of “span”.
If you have some text you want to put into the page directly then you might want to look at the literalControl ( http://msdn.microsoft.com/en-us/library/system.web.ui.literalcontrol.aspx ). This control is designed to be used for “HTML elements, text, and any other strings in an ASP.NET page that do not require processing on the server”.
So you could just do
And avoid needing to use the innerHTML at all.