Foros del Web » Programando para Internet » ASPX (.net) »

Server Control

Estas en el tema de Server Control en el foro de ASPX (.net) en Foros del Web. Hola amigos necesito una ayuda con esto; Estoy programando un control (ASP.NET Server Control) y necesito saber como puede agregar una hoja de estilo (css) ...
  #1 (permalink)  
Antiguo 10/09/2010, 09:02
 
Fecha de Ingreso: mayo-2008
Mensajes: 139
Antigüedad: 16 años
Puntos: 0
Server Control

Hola amigos

necesito una ayuda con esto; Estoy programando un control (ASP.NET Server Control) y necesito saber como puede agregar una hoja de estilo (css) ??

Gracias por su eterna colaboración...
  #2 (permalink)  
Antiguo 11/09/2010, 13:39
Avatar de jaullo  
Fecha de Ingreso: abril-2009
Mensajes: 994
Antigüedad: 15 años
Puntos: 30
Respuesta: Server Control

Algo así seria

VB.NET

Código ASP:
Ver original
  1. <Assembly: WebResource("WhoIsLooking.WhoIsLooking.css", "text/css")>
C#

Código ASP:
Ver original
  1. [Assembly: WebResource("WhoIsLooking.WhoIsLooking.css", "text/css")]

Finally, the WhoIsLooking control includes the following lines of code in its OnPreRender() method:

VB.NET

Código ASP:
Ver original
  1. ' Add style sheet to parent page
  2.  
  3. Dim cssUrl As String = Page.ClientScript.GetWebResourceUrl(Me.GetType(), "WhoIsLooking.WhoIsLooking.css")
  4.  
  5. Dim cssLink As New HtmlLink()
  6.  
  7. cssLink.Href = cssUrl
  8.  
  9. cssLink.Attributes.Add("rel", "stylesheet")
  10.  
  11. cssLink.Attributes.Add("type", "text/css")
  12.  
  13. Page.Header.Controls.Add(cssLink)
  14.  
  15. ' Add class name
  16.  
  17. Me.CssClass = "WhoIsLooking"

C#

// Add style sheet to parent page

Código ASP:
Ver original
  1. string cssUrl = Page.ClientScript.GetWebResourceUrl(this.GetType(),
  2.  
  3. "WhoIsLooking.WhoIsLooking.css");
  4.  
  5. HtmlLink cssLink = new HtmlLink();
  6.  
  7. cssLink.Href = cssUrl;
  8.  
  9. cssLink.Attributes.Add("rel", "stylesheet");
  10.  
  11. cssLink.Attributes.Add("type", "text/css");
  12.  
  13. this.Page.Header.Controls.Add(cssLink);
  14.  
  15. // Add class name
  16.  
  17. this.CssClass = "WhoIsLooking";
__________________
http://geekswithblogs.net/jaullo/Default.aspx
Si te he ayudado regalame Karma positivo!!!

Etiquetas: control, server, aspx
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 19:54.