By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,685 Members | 1,243 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,685 IT Pros & Developers. It's quick & easy.

Load combos

P: n/a
Hello,

I have a list of entities (with properties Key and Description).

Which is the best manner of load dropdownlist with this list ?

1.

ListaTiposInmueble tiposInmueble = bfll.ObtenerListaTiposInmueble();
foreach (TipoInmuebleEntidad tipoInmueble in
tiposInmueble.TiposInmueble.Values)
{
this.ddlTipoInmueble.Items.Add(new
ListItem(tipoInmueble.Fcitem, tipoInmueble.Valor.ToString()));
}

2.

//ListaTiposInmueble tiposInmueble =
bfll.ObtenerListaTiposInmueble();
//if (tiposInmueble != null)
//{
// this.ddlTipoInmueble.Items.Clear();
// this.ddlTipoInmueble.DataSource =
tiposInmueble.Elementos.Values;
// this.ddlTipoInmueble.DataTextField = "Fcitem";
// this.ddlTipoInmueble.DataValueField = "Valor";
// this.ddlTipoInmueble.DataBind();
//}

Thanks in advance

--
http://www.alhambra-eidos.es/web2005/index.html
www.kiquenet.net

Jun 7 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
2.

In many cases you can also do it in .aspx page without codebehind.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Alhambra Eidos Kiquenet" <Al*******************@discussions.microsoft.com >
wrote in message news:CF**********************************@microsof t.com...
Hello,

I have a list of entities (with properties Key and Description).

Which is the best manner of load dropdownlist with this list ?

1.

ListaTiposInmueble tiposInmueble = bfll.ObtenerListaTiposInmueble();
foreach (TipoInmuebleEntidad tipoInmueble in
tiposInmueble.TiposInmueble.Values)
{
this.ddlTipoInmueble.Items.Add(new
ListItem(tipoInmueble.Fcitem, tipoInmueble.Valor.ToString()));
}

2.

//ListaTiposInmueble tiposInmueble =
bfll.ObtenerListaTiposInmueble();
//if (tiposInmueble != null)
//{
// this.ddlTipoInmueble.Items.Clear();
// this.ddlTipoInmueble.DataSource =
tiposInmueble.Elementos.Values;
// this.ddlTipoInmueble.DataTextField = "Fcitem";
// this.ddlTipoInmueble.DataValueField = "Valor";
// this.ddlTipoInmueble.DataBind();
//}

Thanks in advance

--
http://www.alhambra-eidos.es/web2005/index.html
www.kiquenet.net

Jun 7 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.