|
Subject:
|
drop down list and a calendar
|
|
Posted By:
|
mrjoka
|
Post Date:
|
1/18/2007 8:39:59 AM
|
hi experts, actualy i nned your help here. i'm working in a website and i'm facing two problems. the first one is that i want to display today date when no date is selected (an if statement) the second one is that i have 2 drop down list and i want to use also an if statement so when the value of the first drop down list is choosed display a message and when the value of the second drop down list is choosed display another message.
the senario of the first one is: If selecteddate is false calendar1.selecteddate = datetime.now i was unable to find the right if statement.
for the second one is : if Commdrop is selected label.text = " message" if sitedrop is selected label.text = " message"
thanks for your time.
|
|
Reply By:
|
dparsons
|
Reply Date:
|
1/18/2007 9:43:58 AM
|
... Why are you referencing everything as boolean values?
=========================================================== I will only tell you how to do it, not do it for you. Unless, of course, you want to hire me to do work for you. =========================================================== http://www.catb.org/~esr/faqs/smart-questions.html ^^Took that from planoie's profile ===========================================================
|
|
Reply By:
|
mrjoka
|
Reply Date:
|
1/18/2007 10:49:10 AM
|
i'm not i just do not know how to do it or how to start. any help will be appreciated. thanks
|
|
Reply By:
|
dparsons
|
Reply Date:
|
1/18/2007 11:02:39 AM
|
The answer to your dropdown question is to handle the SelectedIndex_Changed event of each drop down. In so far as your other question: are you trying to determine if a date has been selected in the calendar or not? Because, in all reality, when a user enters the page no date will be selected on the calendar so you could do:
if(!Page.IsPostBack){ calendar1.SelectedDate = DateTime.Now(); }
=========================================================== I will only tell you how to do it, not do it for you. Unless, of course, you want to hire me to do work for you. =========================================================== http://www.catb.org/~esr/faqs/smart-questions.html ^^Took that from planoie's profile ===========================================================
|
|
Reply By:
|
mrjoka
|
Reply Date:
|
1/24/2007 4:48:57 AM
|
hi experts,
this is what i have: protected void Date_Selected(object sender, EventArgs e) { if (Calendar1.SelectionMode == CalendarSelectionMode.None) { Calendar1.SelectedDates.Clear(); } switch (Calendar1.SelectedDates.Count) { case (0): //None Label1.Text = "today is: " + CommDrop.SelectedItem.Text + " at " + DateTime.Now; break; case (1): //Day Label1.Text = "today is: " + CommDrop.SelectedItem.Text + " at " + Calendar1.SelectedDate.ToShortDateString(); break; case (7): //Week Label1.Text = "today is: " + CommDrop.SelectedItem.Text + " at " + Calendar1.SelectedDate.ToShortDateString(); break; default: //Month Label1.Text = "today is: " + CommDrop.SelectedItem.Text + " at " + Calendar1.SelectedDate.ToShortDateString(); break; } } this is to choose the date when a date is selected in a callendar: i have also this in the SelectedIndex_Changed for drop down list 1
Label2.Text = "Statistieken voor Community: " + CommDrop.SelectedItem.Text + " at " + Calendar1.SelectedDate.ToShortDateString();
and for drop down list 2
Label2.Text = "Statistieken voor Site: " + SiteDrop.SelectedItem.Value+" at " + Calendar1.SelectedDate.ToShortDateString();
so now when i choose from the drop down list 1 or 2 the date Calendar1.SelectedDate.ToShortDateString() is still the same. what i want is when i choose a date from the callendar the: Calendar1.SelectedDate.ToShortDateString() that in the SelectedIndex_Changed also changed. now it's not changing until i choose another site or community from the drop down list. thanks for any help experts.
|