Red de conocimiento informático - Computadora portátil - ASP.net Cómo crear div en segundo plano

ASP.net Cómo crear div en segundo plano

El método para crear divs en el fondo de ASP.net es:

Herramienta de material original: use System.Web.UI.HtmlControls para introducir el espacio de nombres;

//Crear divs

CreateHtmlTag("div");//llamado para crear una etiqueta div.

///

/// Crear Div, br, span y otras etiquetas Métodos generales

///

private void CreateHtmlTag(string htmlTag)

{

HtmlGenericControl hgg_div = new HtmlGenericControl (htmlTag);

hgg_div.Attributes.Add("style", "width:200px; height. 200px;");

hgg_div.InnerText = "Estoy a " + htmlTag;

Page.Controls.Add(hgg_div);

}

Establecer atributos para div:

hgg_div. Atributos. Add("estilo", "ancho:200px; alto.Attributes.Add("estilo", "ancho:200px; alto:200px;");