Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 18th, 2007, 09:39 AM
Authorized User
 
Join Date: Jan 2007
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default drop down list and a calendar

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.


 
Old January 18th, 2007, 10:43 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

... 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
================================================== =========
 
Old January 18th, 2007, 11:49 AM
Authorized User
 
Join Date: Jan 2007
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i'm not i just do not know how to do it or how to start.
any help will be appreciated.
thanks

 
Old January 18th, 2007, 12:02 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

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
================================================== =========
 
Old January 24th, 2007, 05:48 AM
Authorized User
 
Join Date: Jan 2007
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Drop down list carumuga Classic ASP Basics 1 February 6th, 2007 02:37 PM
calendar and drop down list mrjoka C# 2005 0 January 18th, 2007 06:47 AM
drop down list values based on another drop down noor ASP.NET 1.0 and 1.1 Basics 3 July 5th, 2005 09:57 AM
Drop Down List mrideout BOOK: Beginning ASP.NET 1.0 8 September 16th, 2004 07:11 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.