Foros del Web » Programación para mayores de 30 ;) » .NET »

problemas con los dropDownList

Estas en el tema de problemas con los dropDownList en el foro de .NET en Foros del Web. Hola espero esten bien tengo el siguiente problema tengo un dropDowList que al selecciones un items se llena el sigueinte dropDownList el problema viene cuando ...
  #1 (permalink)  
Antiguo 22/07/2009, 08:25
 
Fecha de Ingreso: enero-2009
Mensajes: 141
Antigüedad: 15 años, 3 meses
Puntos: 1
Pregunta problemas con los dropDownList

Hola espero esten bien tengo el siguiente problema tengo un dropDowList que al selecciones un items se llena el sigueinte dropDownList el problema viene cuando le doy guardar el primer dropdowList se lleva el id q seleccione pero el segundo siempre siempre se lleva el id del primer items asi alla seleccionado el ultimo igual se trae el primero que puede ser eso

gracias....
  #2 (permalink)  
Antiguo 22/07/2009, 09:40
 
Fecha de Ingreso: abril-2007
Mensajes: 71
Antigüedad: 17 años, 1 mes
Puntos: 0
Respuesta: problemas con los dropDownList

Hola,
¿Podrías escribir todo tu código?

Saludos.
__________________
Zona Hosting - Hosting Windows y Linux - Registros de dominios.
  #3 (permalink)  
Antiguo 22/07/2009, 09:54
 
Fecha de Ingreso: enero-2009
Mensajes: 141
Antigüedad: 15 años, 3 meses
Puntos: 1
Respuesta: problemas con los dropDownList

<p>
Descripción Fabricante:
</p>
<p>
<asp:TextBox ID="txtDescri" runat="server" Text='<%# Bind("fab_descripcionFab")%>'></asp:TextBox>
<asp:RequiredFieldValidator ID="validTexDescr" runat="server" ControlToValidate="txtDescri"
ErrorMessage="Debe Escribir una descripción del fabricante." ValidationGroup="InsertValidation">*</asp:RequiredFieldValidator>
</p>
<p class="bold">
Pais Fabricante:</p>
<p>
<asp:DropDownList ID="DropPais" runat="server" DataSourceID="FabPaisData" OnDataBound="dropPais_DataBound"
DataTextField="Pais_nombre" DataValueField="Pais_idPais" AutoPostBack="True"
onselectedindexchanged="DropPais_SelectedIndexChan ged" CausesValidation="false" >
</asp:DropDownList>
<asp:RequiredFieldValidator ID="ValidatorGrupos" runat="server" ControlToValidate="DropPais"
ErrorMessage="Debe elegir el pais a donde pertence el fabricante" InitialValue="0"
ValidationGroup="InsertValidation">*</asp:RequiredFieldValidator>
</p>
<p class="bold">

-----------------------------------------------------------------------------------------------------------------------

protected void dropPais_DataBound(object sender, EventArgs e)
{
if (Eval("fab_idPaisFab") != null)
{
idPais = int.Parse(Eval("fab_idPaisFab").ToString());
}


if (idFabricante == 0)
((DropDownList)sender).Items.Insert(0, new ListItem("Seleccione...", "0"));
else
{
((DropDownList)sender).Items.Insert(0, new ListItem("Seleccione...", "0"));
((DropDownList)sender).Items.FindByValue(idPais.To String()).Selected = true;

}


if(formFab.CurrentMode == FormViewMode.Edit || formFab.CurrentMode == FormViewMode.ReadOnly)
{
GMS.Entidades.Generales.Fabricante fabricante = new GMS.Entidades.Generales.Fabricante();

FabCiudadData.SelectParameters["Fab_idPais"].DefaultValue = idPais.ToString();


((DropDownList)this.formFab.FindControl("DropCiuda d")).DataBind();

}
}


protected void DropPais_SelectedIndexChanged(object sender, EventArgs e)
{

GMS.Entidades.Generales.Fabricante fabricante = new GMS.Entidades.Generales.Fabricante();

fabricante.fab_idPaisFab = int.Parse(((DropDownList)this.formFab.FindControl( "DropPais")).SelectedItem.Value);

FabCiudadData.SelectParameters["Fab_idPais"].DefaultValue = fabricante.fab_idPaisFab.ToString();

((DropDownList)this.formFab.FindControl("DropCiuda d")).DataBind();

fabricante.fab_idCiudadFab = int.Parse(((DropDownList)this.formFab.FindControl( "DropCiudad")).SelectedItem.Value);
}



protected void dropCiudad_DataBound(object sender, EventArgs e)
{
GMS.Entidades.Generales.Fabricante fabricante = new GMS.Entidades.Generales.Fabricante();

if ( ((DropDownList)sender).Items.Count != 0 )
{

if (idFabricante != 0 && bandera != 0)
{
idCiudad = int.Parse(((HiddenField)this.formFab.FindControl(" idCiudadHidden")).Value);
((DropDownList)sender).Items.Insert(0, new ListItem("Seleccione...", "0"));
((DropDownList)sender).Items.FindByValue(idCiudad. ToString()).Selected = true;

}
bandera = 1;
}

}
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 04:05.