![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
11/09/2008, 09:08
|
| | Fecha de Ingreso: enero-2008
Mensajes: 144
Antigüedad: 17 años, 1 mes 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
}
} |