Ver Mensaje Individual
  #2 (permalink)  
Antiguo 11/07/2010, 10:58
Avatar de gakutaru
gakutaru
 
Fecha de Ingreso: agosto-2005
Ubicación: frente a mi NtbK
Mensajes: 239
Antigüedad: 18 años, 8 meses
Puntos: 6
Respuesta: Pasar Valor de Dropdowlist a TextBox?

Código HTML:
Ver original
  1. <asp:DropDownList runat="server" ID="drpCambio" AutoPostBack="true" OnSelectedIndexChanged="Cambio">
  2. <asp:ListItem Text="Valor1" Value="Valor1"></asp:ListItem>
  3. <asp:ListItem Text="Valor2" Value="Valor2"></asp:ListItem>
  4. </asp:DropDownList>

Código vb:
Ver original
  1. Sub Cambio(ByVal s As Object, ByVal e As EventArgs)
  2.         If drpCambio.SelectedValue = "Valor1" Then
  3.             txtCaja1.text = "primer texto"
  4.         Else
  5.             txtCaja2.text = "SegundoTexto texto"
  6.         End If
  7.     End Sub

si te fijas, el dropdownlist tiene autpostback = true y si cambian el valor, se autoenvia a la funcion Cambio, la funcion cambio determina que valor esta seleccionado, si esta seleccionado el valor1, la textbox 'Caja1' cambia el valor.