473,662 Members | 2,666 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dynamic drop downs

i have 2 drop downs that have months in them such as
1/1/2005 and 1/31/2005

I need to my starting month drop down to be a month behind the end of month

so something like this:
if month ending = 1/31/2006
I need start month = 12/31/2005

how can I do thi? is it possible?
its kind of a backwards thing, but the month end dropdown can be populated
from a querystring so if 1/31/2006 is passed I need to set the start month
to be 12/31/2005
Dec 6 '06 #1
4 1124
Hello Mike,

From your description, you have an ASP.NET page which has two dropdownlists
and they'll display two month values and you want to make one list's
selected month 1 month behind another(start and end), correct?

As for this scenario, I think it is a typical dropdownlist synchornize
issue, I'm wondering how would like to implement the synchronizing between
the two values, use server-side code logic or client-side script?

Generally, most page will use client script to manipulate such cascading
value changes in associated dropdownlists. you can hook the
dropdownlist(<s electhtml element)'s client-side "onchange" event. BTW,
are the months items in each list fixed? For example, both of the list only
contains 12 months(items)? If so, you can even use selectedIndex value to
determine how to adjust each list's selected value.

Please feel free to let me know your detailed scenario and requirement.
Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

=============== =============== =============== =====

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Dec 6 '06 #2
If you are doing it server-side you can determine the startDate doing
something like this:

'This is where you would convert your querystring to a datetime object
Dim endDate As DateTime = System.Convert. ToDateTime("1/31/2006")

'startDate will be the last day of the month previous to the endDate
Dim startDate As DateTime =
endDate.AddDays (-endDate.DaysInM onth(endDate.Ye ar, endDate.Month))

You could then select the listbox item that matches the date.

Like Steven said, most people do this on the client-side so that you don't
have to do a post-back to figure out what to select in the dropdown. If you
know JavaScript its not that hard to do.

--
Nick Wegner

"Steven Cheng[MSFT]" wrote:
Hello Mike,

From your description, you have an ASP.NET page which has two dropdownlists
and they'll display two month values and you want to make one list's
selected month 1 month behind another(start and end), correct?

As for this scenario, I think it is a typical dropdownlist synchornize
issue, I'm wondering how would like to implement the synchronizing between
the two values, use server-side code logic or client-side script?

Generally, most page will use client script to manipulate such cascading
value changes in associated dropdownlists. you can hook the
dropdownlist(<s electhtml element)'s client-side "onchange" event. BTW,
are the months items in each list fixed? For example, both of the list only
contains 12 months(items)? If so, you can even use selectedIndex value to
determine how to adjust each list's selected value.

Please feel free to let me know your detailed scenario and requirement.
Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

=============== =============== =============== =====

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Dec 6 '06 #3
Mike,

So, did you want to do this client side or server side? Do you still need
help with this?

--
Nick Wegner

"igotyourdotnet " wrote:
Both list are fixed and contain 12 months for the passed 10 years. So they
can have dates from 11/01/2006 back to 1/1/1998.

so if 11/31/2005 is passed as the ending date I need 10/01/2005 as the start
date.
"Steven Cheng[MSFT]" wrote:
Hello Mike,

From your description, you have an ASP.NET page which has two dropdownlists
and they'll display two month values and you want to make one list's
selected month 1 month behind another(start and end), correct?

As for this scenario, I think it is a typical dropdownlist synchornize
issue, I'm wondering how would like to implement the synchronizing between
the two values, use server-side code logic or client-side script?

Generally, most page will use client script to manipulate such cascading
value changes in associated dropdownlists. you can hook the
dropdownlist(<s electhtml element)'s client-side "onchange" event. BTW,
are the months items in each list fixed? For example, both of the list only
contains 12 months(items)? If so, you can even use selectedIndex value to
determine how to adjust each list's selected value.

Please feel free to let me know your detailed scenario and requirement.
Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

=============== =============== =============== =====

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.
Dec 7 '06 #4
Hi Mike,

Here is a simple example page which use pure client-side script to
synchornize the two dropdownlist(<s elect>), both of them contain 24 months:

=============== =============== =====
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
<script type="text/javascript">
function sync_lists(sour ce)
{
var lst1 = document.getEle mentById("lstSt art");
var lst2 = document.getEle mentById("lstEn d");


if(lst1.selecte dIndex == lst1.options.le ngth-1)
{
lst1.selectedIn dex = lst2.selectedIn dex - 1;
}
else if(lst2.selecte dIndex == 0)
{
lst2.selectedIn dex = lst1.selectedIn dex + 1;
}
else
{

if(source == 0)
{
lst2.selectedIn dex = lst1.selectedIn dex + 1;
}
else
{
lst1.selectedIn dex = lst2.selectedIn dex - 1;
}
}
}

</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<select id="lstStart" name="lstStart" onchange="sync_ lists(0);" >
<option selected="selec ted" >06-01</option>
<option>06-02</option>
<option>06-03</option>
<option>06-04</option>
<option>06-05</option>
<option>06-06</option>
<option>06-07</option>
<option>06-08</option>
<option>06-09</option>
<option>06-10</option>
<option>06-11</option>
<option>06-12</option>
<option>07-01</option>
<option>07-02</option>
<option>07-03</option>
<option>07-04</option>
<option>07-05</option>
<option>07-06</option>
<option>07-07</option>
<option>07-08</option>
<option>07-09</option>
<option>07-10</option>
<option>07-11</option>
<option>07-12</option>
</select>

<select id="lstEnd" name="lstEnd" onchange="sync_ lists(1);">
<option >06-01</option>
<option selected="selec ted">06-02</option>
<option>06-03</option>
<option>06-04</option>
<option>06-05</option>
<option>06-06</option>
<option>06-07</option>
<option>06-08</option>
<option>06-09</option>
<option>06-10</option>
<option>06-11</option>
<option>06-12</option>
<option>07-01</option>
<option>07-02</option>
<option>07-03</option>
<option>07-04</option>
<option>07-05</option>
<option>07-06</option>
<option>07-07</option>
<option>07-08</option>
<option>07-09</option>
<option>07-10</option>
<option>07-11</option>
<option>07-12</option>
</select>
</div>
</form>
</body>
</html>
=============== =============== ========

Hope this helps some.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Dec 8 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

46
5125
by: Kingdom | last post by:
In my data base I have a list of componet types e.g. type A - I have 8 off - type B I have 12 off etc. I'm using Set objRS = objDC.Execute("Select DISTINCT Component_Type FROM Parts_Table") to populate a drop down but would like to use several drop downs restricting the contents of each drop down to the records pertaining to one
3
1467
by: CSharpguy | last post by:
I have 3 drop downs that are populated from the databasem 4 of my web pages need to have this drop down, how can I trap the selection made in the drop down and popuate my grid on my form?
1
3590
by: Jeff Gardner | last post by:
Greetings: I have a table with 3 pieces of data that I would like to use to dynamically populate 3 drop downs using javascript. The fields are state, orgname, office. If it's not already obvious, I'd like orgname drop down to change when a state is selected and I would like office drop down to change when an orgname is selected. I can do this with multiple tables but am having difficulty getting it to work when the data is in the...
0
1543
by: Steve Funk | last post by:
All, I have searched all around and have not yet found the answer to this nor a solution. Hopfully it will be easy to overcome. Here is what I am trying to do: I'm trying to build a wizard form completely dynamic. I'm adding the labels, textboxes, drop downs, radio buttons, etc dynamically. I am able to add them via Page Init. Which seems to re-add every time a button or post back is initiated. Don't know if this is the problem.
1
1834
by: MiG | last post by:
Hello all, I want to make a dynamic 4 drop down menus with AJAX and PHP/mySQL, like this: Category->dynamic subCategory County->dynamic cityCounty Is there any good tutorial that can teach me how to do this? I managed
1
1352
by: JackInDaBox | last post by:
Hello, I am new to this and have run into a small problem. I am using the Ajax toolkit with VS 2005 to fill some drop downs through a web service and it works great. All of the cascading drop downs work correctly. The only problem I have is I need to copy the drop downs value from each cascading drop down into a hidden drop down. I have struggled with this for a few days now so if anyone could offer me some advice I would really appreciate...
4
1673
by: phub11 | last post by:
Hi, I've found a great website which can extract data from a MySQL database and populate chained drop downs. (http://www.noboxmedia.com/20/massive-ajax-countryarea-drop-down-list/) I'd like the option of a user "dynamically" uploading their Excel file, extracting certain data, and including their data in the drop downs too. All this without the users data needed to be stored on the server longer than necessary. The only way I can see...
14
2254
by: maya | last post by:
hi, I need help with a dynamic nav menu, http://www.mayacove.com/design/nav/nav.html it looks like I want it in IE 7, but in FF and IE 6 it's totally messed up.. in FF the main-nav section looks fine, but the drop-downs are totally messed up.. in IE6 for some reason the functionality is totally messed up, I get JavaScript errors, I guess that's for JS group....;)
4
2764
by: audreyality | last post by:
I am new to javascript and appreciate any guidance on this issue, so thank you in advance for your advice! Situation: I am working with a form that will send information to a database. I need the following: A drop-down box of options that onChange=... Opens another drop-down box of unique options that onChange=... Displays text dependent on which option you chose. An example:
0
8435
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8345
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8857
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8768
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7368
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4181
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4348
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1754
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.