Ver Mensaje Individual
  #2 (permalink)  
Antiguo 11/09/2008, 09:08
diegolo
 
Fecha de Ingreso: enero-2008
Mensajes: 144
Antigüedad: 16 años, 4 meses
Puntos: 2
Respuesta: Dropdown y valor por defecto

Hola,ojala te sirva
esta hecho en c# 2003
public void funciontal...()
{
try
{
DataSet ds = tudataset(" SELECT codigo,nombre from "+
" tabla order by codigo" );
DataRow dr;
dr = ds.Tables[0].NewRow();
ds.Tables[0].Rows.InsertAt(dr,0);
dr[0]="0";dr[1]="--Seleccione--";
ds.Tables[0].AcceptChanges();
this.dropdownlist1.DataSource=ds;
this.dropdownlist1.DataTextField = "nombre";
this.dropdownlist1.DataValueField ="codigo";
this.dropdownlist1.DataBind ();
}
catch(SystemException err)
{
mensaje de error( si deeseas)
}
finally
{
mensaje de que valio o mejor cierra la base
}

}