|    
			
				22/07/2009, 09:54
			
			
			  | 
  |   |  |  |  Fecha de Ingreso: enero-2009 
						Mensajes: 141
					 Antigüedad: 16 años, 9 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;
 }
 
 }
     |