Ver Mensaje Individual
  #3 (permalink)  
Antiguo 16/02/2005, 06:47
Avatar de Sayra
Sayra
 
Fecha de Ingreso: diciembre-2004
Mensajes: 365
Antigüedad: 19 años, 10 meses
Puntos: 1
Bueno a lo que te entendi es algo asi , no? bueno asi asi no me carga ni el dropdownlist2 ni eldropdwonlist3 aunque seleccione items en el dropdownlist1,

Y antes de que me lo preguntes todos los drop tienen la propiedad autopostback en true

Sub Page_Load(Sender As Object, E As EventArgs)

If Not IsPostBack

Dim ds As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter

ds = New DataSet ()
MyConnection = New SqlConnection("SERVER=MDS01; DATABASE=be; INTEGRATED SECURITY=false;PASSWORD=sa;USER=sa")

MyCommand = New SqlDataAdapter ("select EstadoID, Nombre_Estado from Estado", MyConnection)
MyCommand.Fill(ds,"Estado")

DropDownList1.DataSource = ds.Tables("Estado").DefaultView
DropDownList1.DataTextField = "Nombre_Estado"
DropDownList1.DataValueField ="EstadoID"
DropDownList1.DataBind()

end if
end sub


Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim dc As DataSet
Dim MyConnection2 As SqlConnection
Dim MyCommand2 As SqlDataAdapter

dc = New DataSet ()
MyConnection2 = New SqlConnection("SERVER=MDS01; DATABASE=be; INTEGRATED SECURITY=false;PASSWORD=sa;USER=sa")

MyCommand2 = New SqlDataAdapter ("select CiudadID, Nombre_Ciudad from Ciudad Where EstadoID=" &DropDownList1.SelectedItem.Value, MyConnection2)
MyCommand2.Fill(dc,"Ciudad")

DropDownList2.DataSource = dc.Tables("Ciudad").DefaultView
DropDownList2.DataTextField = "Nombre_Ciudad"
DropDownList2.DataValueField ="CiudadID"
DropDownList2.DataBind()

End Sub


Private Sub DropDownList2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim du As DataSet
Dim MyConnection3 As SqlConnection
Dim MyCommand3 As SqlDataAdapter
du = New DataSet ()
MyConnection3 = New SqlConnection("SERVER=MDS01; DATABASE=be; INTEGRATED SECURITY=false;PASSWORD=sa;USER=sa")

MyCommand3 = New SqlDataAdapter("select UbicacionID, Descripcion from Ubicacion Where CiudadID=" &DropDownList2.SelectedItem.Value, MyConnection3)
MyCommand3.Fill(du,"Ubicacion")

DropDownList3.DataSource = du.Tables("Ubicacion").DefaultView
DropDownList3.DataTextField = "Descripcion"
DropDownList3.DataValueField ="UbicacionID"
DropDownList3.DataBind()

End Sub