ASP.NET - DropDownList

 
Vista:

DropDownList

Publicado por FERNANDO (3 intervenciones) el 10/01/2013 14:20:50
Buenas,
necesito ejecutar una funcion de un script segun lo seleccionado en un DropDownList1.
Gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

DropDownList

Publicado por charlos (25 intervenciones) el 30/01/2013 18:02:31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<script language="c#" runat="server">
void Page_Load(Object s, EventArgs E)
{
 
              DropDownList1.Attributes.Add("onchange", "function hola();");
 
}
 
</script>
<html>
<script type="text/javascript">
     function hola()
           {
                alert("HOLA!!!");
           }
</script>
</html>
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

DropDownList

Publicado por Cristian Pereira (65 intervenciones) el 02/08/2013 21:03:19
<script language="c#" runat="server">
void Page_Load(Object s, EventArgs E)
{

DropDownList1.Attributes.Add("onchange", "hola(this);");

}

</script>
<html>
<script type="text/javascript">
function hola(obj)
{
alert("Value seleccionado:" + obj.value + ' Text seleccionado: ' + obj.options[obj.selectedIndex].text);
}
</script>
</html>
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar