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

Agregar atributo al tag <body>!

Estas en el tema de Agregar atributo al tag <body>! en el foro de ASPX (.net) en Foros del Web. Hola a todos!! ¿Cómo puedo colocar un atributo al tag <body> en el lado del servidor? He intentado con ClientScript.RegisterClientScriptBlock en ASP 2.0 pero lo ...
  #1 (permalink)  
Antiguo 30/10/2006, 18:36
Avatar de GustavoPY  
Fecha de Ingreso: marzo-2002
Ubicación: Capiatá
Mensajes: 88
Antigüedad: 22 años, 1 mes
Puntos: 0
Pregunta Agregar atributo al tag <body>!

Hola a todos!!

¿Cómo puedo colocar un atributo al tag <body> en el lado del servidor?

He intentado con ClientScript.RegisterClientScriptBlock en ASP 2.0 pero lo hace entre el tag <body> </body>

Desde ya muchas gracias!
__________________
*********************************
Gustavo Arriola
http://www.gustavoarriola.com
*********************************
  #2 (permalink)  
Antiguo 01/11/2006, 12:44
 
Fecha de Ingreso: octubre-2006
Mensajes: 53
Antigüedad: 17 años, 7 meses
Puntos: 1
Hola

MIra no se si esto sirva pero nada se pierde probando.

1) ponerle runat=server y ID="<nombre>" a la etiqueta <body...>
2) en el lado del servidor hay una coleccion llamada HtmlGenericControls con eso puedes modificar
3) para agregar atributos pon lo siguiente
objeto.Attibutes.Add("class","estilo")

y asi sucesivamente. espero te sirva, cualquier cosita a [email protected] ó [email protected]
  #3 (permalink)  
Antiguo 01/11/2006, 13:29
Avatar de jhonwilliams  
Fecha de Ingreso: marzo-2004
Ubicación: Copacabana - Colombia
Mensajes: 1.484
Antigüedad: 20 años, 1 mes
Puntos: 76
Talvez esto te pueda ayudar:

You create a user control named Address that is defined in a file named Address.ascx. Address
displays address fields in an HTML table.
Some container pages might contain more than one instance of the Address user control. For
example, a page might contain a shipping address and a billing address. You add a public
property named TKCaption to the Address user control. The caption property will be used to
distinguish the different instances.
You want the caption to be displayed in the first <td> element of the table of address fields.
You need to add code to the <td> element of the table to display the caption.

Which code should you use?
A. <td><%=TKCaption%></td>
B. <td><script runat=”server”>TKCaption</script></td>
C. <td><script>document.write(“TKCaption”);</scripts></td>
D. <td>=TKCaption</td>

Answer: A
Explanation: TKCaption is a public property contained on the Web server. We reference it with the
<%=TKCaption%> element
Incorrect Answers
B, C: Scrips are not called for. We just want to display a property.
D: To access the public property we must use an <% %> element.

Saludos
__________________
Si mi respuesta te ha ayudado, agradezco que me regales unos puntos de Karma XD.

"Una mujer sería encantadora si uno pudiera caer en sus brazos sin caer en sus manos." (Ambrose Bierce)
  #4 (permalink)  
Antiguo 01/11/2006, 14:02
Avatar de GustavoPY  
Fecha de Ingreso: marzo-2002
Ubicación: Capiatá
Mensajes: 88
Antigüedad: 22 años, 1 mes
Puntos: 0
Gracias!
Lo he solucionado usando los puntos 1 y 3 directamente!
donde (en el punto 3) "objeto" es el ID que especifiqué en el punto 1

Gracias por todo!
Saludos cordiales!
__________________
*********************************
Gustavo Arriola
http://www.gustavoarriola.com
*********************************
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 08:59.