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. 3 14160
First thing is to remove the word "script" from your vocabulary. VB .NET is
not VBScript.
You could write some code in the .aspx.vb (code-behind) Page_Load event that
will populate the drop down lists by determining today's date (now) and then
use the various methods of the now value to extract the day, month and year.
Then, via looping, you can build up the items on the lists.
"Miguel Dias Moura" <we****@27NOSPAMlamps.com> wrote in message
news:Oy**************@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.
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" <we****@27NOSPAMlamps.com> wrote in message
news:Oy**************@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.
One obvious error in my code, make 2nd line:
DateTimeFormatInfo dtfi = new DateTimeFormatInfo();
But then, you have to convert the concept into VB.Net anyway, so it probably
didn't throw you too much.
Good luck
Dale
"DalePres" <don-t-spa-m-me@lea-ve-me-a-lone--.com> wrote in message
news:uy**************@TK2MSFTNGP09.phx.gbl... 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" <we****@27NOSPAMlamps.com> wrote in message news:Oy**************@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.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: julian |
last post by:
hi
I was wondering if anyone can help me out on this....
I have dynamcally populated a drop down menu with data from an access
database using ASP. The values seem fine, however when i pass...
|
by: msnews.microsoft.com |
last post by:
I'd like to hear your thoughts on best methods for populating drop down list
controls. I have states and countries drop down lists that don't change
often, so naturally I "hard code" them in the...
|
by: csgraham74 |
last post by:
Hi Guys,
I am currently building a web aplication in ASP.Net. On the onload
event of a page a have a function to populate the many drop down lists
on my page.
I have one parameter table which...
|
by: Miguel Dias Moura |
last post by:
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...
|
by: puja |
last post by:
hi all,
I have a requirement where I need to populate drop down list (which is not
run at server control. i.e it is an html control ) using server side code in
C#?
How can I add option values...
|
by: tom c |
last post by:
I have a dropdown list box on an ASP.Net 1.1 webform. I populate it
from a dataset in code. Everything looks fine and I can see all the
values in the dropdownlist. I can select a value and I see...
|
by: Yi Chen |
last post by:
We have a drop down list on a PHP page, with several product names, and
when people click one item, we will refresh the same page with the
product name as parameter, and in turn we want to include...
|
by: penny111 |
last post by:
Hi there,
For my application, i need to have 3 drop down lists
1. drop down list of folder names
2. drop down list of documents in the folder selected
3. drop down list of instances of the...
|
by: DaveRook |
last post by:
Hi
I am using C# and Access databse for a web site.
I have a drop down list which I need to populate dynamically according to results in a database.
Example
There will be 1 drop down list...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: Mushico |
last post by:
How to calculate date of retirement from date of birth
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
| |