473,396 Members | 1,966 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ASP.NET Reset Controls to default values question

this may be a simple thing ... I am trying to reset all
the page controls to their original setting, in the first
line of this method call (event). I want to dynamically
change the days of month in a dropdownlist list depending
on the users selected month in the month's
dropdownlist ... i am using AutoPostBack on the
dropdownlists ... can anyone offer suggestions? Thanks ..
here's the method ..

private void ddlStartMonth_SelectedIndexChanged(object
sender, System.EventArgs e)
{
// need to reset all page controls to original setting
if (ddlStartMonth.SelectedItem.Value == "2")
{
ddlStartDay.Items.RemoveAt(33);
ddlStartDay.Items.RemoveAt(32);
ddlStartDay.Items.RemoveAt(31);
}
else if (ddlStartMonth.SelectedItem.Value == "4")
{
ddlStartDay.Items.RemoveAt(33);
}
else if (ddlStartMonth.SelectedItem.Value == "6")
{
ddlStartDay.Items.RemoveAt(33);
}
else if (ddlStartMonth.SelectedItem.Value == "9")
{
ddlStartDay.Items.RemoveAt(33);
}
else if (ddlStartMonth.SelectedItem.Value == "11")
{
ddlStartDay.Items.RemoveAt(33);
}
}

what happens is the first month selected works, but now
the items have been removed from the dropdownlist, so the
second time the method is called, it's not working with
the full, default 31 day dropdownlist.

Sorry for the lengthy post, thanks ..
psinyc
Nov 17 '05 #1
0 1975

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

Similar topics

4
by: Chris Lane | last post by:
Hi, I have an HTML RESET button and Web Control Button that posts back to the server. Problem is the reset button doesn't work after the postback occurs. Any ideas or suggestions as to why this...
1
by: NancyASAP | last post by:
Thought I'd share this since it took me a long time to get it working. Thanks to a bunch of contributers in Google Groups who shared javascript, etc. The question was: How can I put a reset...
2
by: Lance | last post by:
I want to be able to reset a complex property in a PropertyGrid. I know that for properties that are ValueTypes you can include System.ComponentModel.DefaultValue in the declaration of the property....
0
by: Mike Collins | last post by:
I someone can please help, I am about at an end in trying to figure this out. I am adding some dynamic controls to my page (I found out that I was supposed to be doing that in the oninit event,...
11
by: newbie | last post by:
i have a form in which a hidden field (initial value as '0', and my javascript set it to '1' when an event is trigged). In the same form, i have a reset field. But I realized that the hidden field...
3
by: Dave Hughes | last post by:
Hi, I've run across a problem styling form controls (quel surprise), or rather in this case, "unstyling" them. I'm trying to put together a theme for a web application which has a fairly...
16
by: Giovanni D'Ascola | last post by:
Hi. I noticed that <input type="reset"actually don't enable checkbutton which are checked by default after they have been disabled by javascript. It's a bug?
1
by: artev | last post by:
if in a page I have a search form, where want use metho reset() for reset default value I notice that after a research, for the method, the default values isn't more the initially load form but...
3
by: artev | last post by:
if in a page I have a search form and I want use the method reset() for reinsert the default values, I notice that after a research, for the method reset(), the default values aren't more that...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.