Re: Populate a Drop Down List
From: DalePres (don-t-spa-m-me_at_lea-ve-me-a-lone--.com)
Date: 06/12/04
- Next message: Joe Fallon: "Re: Secure page with Insecure Elements"
- Previous message: Wayne M J: "Re: DataGrid ordering"
- In reply to: Miguel Dias Moura: "Populate a Drop Down List"
- Next in thread: DalePres: "Re: Populate a Drop Down List"
- Reply: DalePres: "Re: Populate a Drop Down List"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 11 Jun 2004 21:40:02 -0500
Create a ListItem. Set the value and the text properties and then add it to
the drop down list. I'm not sure about VB.Net but in C# it would be
something like this:
using System.Globalization;
dtfi = new DateTimeFormatInfo();
for (int month = 1; month < 13; month ++)
{
ListItem li = new ListItem();
li.Text = dtfi.GetMonthName(month);
li.Value = month;
ddlMonth.Items.Add(li);
}
Do basically the same thing for each drop down list. Translating the C# to
VB should be pretty straight forward.
Hope this helps,
Dale
"Miguel Dias Moura" <web001@27NOSPAMlamps.com> wrote in message
news:OyUB0xBUEHA.1012@TK2MSFTNGP09.phx.gbl...
> Hello,
>
> i have an ASP.NET / VB page where i have a few 4 groups of Drop Down
Lists.
> Each group of Drop Down Lists include 3 Drop Down Lists for date such as:
> DAY, MONTH, and YEAR.
>
> I don't want to insert the values and text to each drop down list.
>
> So i want to create a script that populates a certain Drop Down List with
> certain values when page loads such as:
>
> Day: 1,2,3,4,5,...
> Month: January, February, ..., December
> Year: 2004, 2003, 2002, 2001, ....
>
> This way in that script i will be able to control how all the Drop Down
> Lists are populated just bu changing the script.
>
> Can you help me out?
>
> Thank You,
> Miguel
>
> P.S: I am working with ASP.NET / VB.
>
>
- Next message: Joe Fallon: "Re: Secure page with Insecure Elements"
- Previous message: Wayne M J: "Re: DataGrid ordering"
- In reply to: Miguel Dias Moura: "Populate a Drop Down List"
- Next in thread: DalePres: "Re: Populate a Drop Down List"
- Reply: DalePres: "Re: Populate a Drop Down List"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|