Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript to control a DDL in D#

Status
Not open for further replies.

Davidwe

Programmer
Jan 10, 2005
6
US
I would like to use JavaScript to have the current month selected in a dropdown list created in C#. The dropdown list has the twelve months as items. The name of the ddl is cmbMonth. It needs to show the current month when another dropdown list (cmbSearch) changes. Here is the C# code that works:

if (cmbSearch.SelectedIndex == 1)
{
cmbMonth.ClearSelection();
cmbMonth.Items.FindByValue(DateTime.Now.Month.ToString()).Selected = true;
}

Now I am attempting to do the same thing on the client side using JavaScript in the html section.

It will look something like this:

if (window.document.form1.cmbSearch.selectedIndex == 1)
{
(code for cmbMonth goes here)
}

Any suggestions? Thanks.
 
The subject should be:

Javascript to control a DDL in C#
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top