Combos en cascada en detailsview
La consulta es: como se haría para lograr que dos dropdownlist que se encuentran contenidos en un detailview logren la funcionalidad; esto es, selecciono el primer dropdownlist y que se actualice a esa selección el segundo dropdownlist (algo así como que selecciono Marca de automóvil y en el segundo dropdownlist se muestra las opciones de autos disponibles). Trate con esto pero...:
Protected Sub ddTipoAccionEdit_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Dim dsc As SqlDataSource = Me.FindControl("SqlDataSubTipoAccionX")
Dim dtv_detalle As DetailsView = CType(Me.FindControl("DetailsView1"), DetailsView)
Dim ddl1 As DropDownList = CType(dtv_detalle.FindControl("ddTipoAccionEdit"), DropDownList)
Dim ddl2 As DropDownList = CType(dtv_detalle.FindControl("ddSubTipoAccionEdit"), DropDownList)
dsc.SelectParameters(0).DefaultValue = ddl1.SelectedValue
ddl2.DataBind()
End Sub
Protected Sub ddTipoAccionEdit_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Dim dsc As SqlDataSource = Me.FindControl("SqlDataSubTipoAccionX")
Dim dtv_detalle As DetailsView = CType(Me.FindControl("DetailsView1"), DetailsView) Dim ddl1 As DropDownList = CType(dtv_detalle.FindControl("ddTipoAccionEdit"), DropDownList) Dim ddl2 As DropDownList = CType(dtv_detalle.FindControl("ddSubTipoAccionEdit"), DropDownList) 'Me.DetailsView1.FindControl("ddSubTipoAccionEdit") dsc.SelectParameters(0).DefaultValue = ddl1.SelectedValue ddl2.DataBind() End Sub
Protected Sub DetailsView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles DetailsView1.DataBound
If DetailsView1.CurrentMode = DetailsViewMode.Edit Then
Dim dv As System.Data.DataRowView = DetailsView1.DataItem
Dim ddl2 As DropDownList = DetailsView1.FindControl("ddSubTipoAccionEdit")
Dim dsc As SqlDataSource = DetailsView1.FindControl("SqlDataSubTipoAccionX")
Dim m As Integer = dv("IdTipoAccion")
dsc.SelectParameters("IdTipoAccion").DefaultValue = m
ddl2.DataBind()
If Not IsDBNull(dv("IdSubtipoAccion")) Then
ddl2.SelectedValue = dv("IdSubtipoAccion")
End If
End If
End Sub
Protected Sub DetailsView1_ItemUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewUpdateEventArgs) Handles DetailsView1.ItemUpdating
Dim ddl2 As DropDownList = DetailsView1.FindControl("ddSubTipoAccionEdit")
e.NewValues("IdSubTipoAccion") = ddl2.SelectedValue
End Sub
Protected Sub DetailsView1_ItemUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewUpdateEventArgs) Handles DetailsView1.ItemUpdating Dim ddl2 As DropDownList = DetailsView1.FindControl("ddSubTipoAccionEdit") e.NewValues("IdSubTipoAccion") = ddl2.SelectedValue
End Sub
Atentamente.
Miguel A. Nieva
Tec. En Informatica
Sgo. Del Estero
Argentina
Protected Sub ddTipoAccionEdit_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Dim dsc As SqlDataSource = Me.FindControl("SqlDataSubTipoAccionX")
Dim dtv_detalle As DetailsView = CType(Me.FindControl("DetailsView1"), DetailsView)
Dim ddl1 As DropDownList = CType(dtv_detalle.FindControl("ddTipoAccionEdit"), DropDownList)
Dim ddl2 As DropDownList = CType(dtv_detalle.FindControl("ddSubTipoAccionEdit"), DropDownList)
dsc.SelectParameters(0).DefaultValue = ddl1.SelectedValue
ddl2.DataBind()
End Sub
Protected Sub ddTipoAccionEdit_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Dim dsc As SqlDataSource = Me.FindControl("SqlDataSubTipoAccionX")
Dim dtv_detalle As DetailsView = CType(Me.FindControl("DetailsView1"), DetailsView) Dim ddl1 As DropDownList = CType(dtv_detalle.FindControl("ddTipoAccionEdit"), DropDownList) Dim ddl2 As DropDownList = CType(dtv_detalle.FindControl("ddSubTipoAccionEdit"), DropDownList) 'Me.DetailsView1.FindControl("ddSubTipoAccionEdit") dsc.SelectParameters(0).DefaultValue = ddl1.SelectedValue ddl2.DataBind() End Sub
Protected Sub DetailsView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles DetailsView1.DataBound
If DetailsView1.CurrentMode = DetailsViewMode.Edit Then
Dim dv As System.Data.DataRowView = DetailsView1.DataItem
Dim ddl2 As DropDownList = DetailsView1.FindControl("ddSubTipoAccionEdit")
Dim dsc As SqlDataSource = DetailsView1.FindControl("SqlDataSubTipoAccionX")
Dim m As Integer = dv("IdTipoAccion")
dsc.SelectParameters("IdTipoAccion").DefaultValue = m
ddl2.DataBind()
If Not IsDBNull(dv("IdSubtipoAccion")) Then
ddl2.SelectedValue = dv("IdSubtipoAccion")
End If
End If
End Sub
Protected Sub DetailsView1_ItemUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewUpdateEventArgs) Handles DetailsView1.ItemUpdating
Dim ddl2 As DropDownList = DetailsView1.FindControl("ddSubTipoAccionEdit")
e.NewValues("IdSubTipoAccion") = ddl2.SelectedValue
End Sub
Protected Sub DetailsView1_ItemUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewUpdateEventArgs) Handles DetailsView1.ItemUpdating Dim ddl2 As DropDownList = DetailsView1.FindControl("ddSubTipoAccionEdit") e.NewValues("IdSubTipoAccion") = ddl2.SelectedValue
End Sub
Atentamente.
Miguel A. Nieva
Tec. En Informatica
Sgo. Del Estero
Argentina
1 respuesta
Respuesta de hfpg2001
-1